SYNOPSIS
#include <stdlib.h>
u_int32_t arc4random(void);
void arc4random_buf(void *buf, size_t nbytes);
u_int32_t arc4random_uniform(u_int32_t upper_bound);
void arc4random_stir(void);
void arc4random_addrandom(unsigned char *dat, int datlen);
DESCRIPTION
The
The
There is no need to call
EXAMPLES
The following produces a drop-in replacement for the traditional rand() and random() functions using arc4random():
#define foo4random() (arc4random() % ((unsigned)RAND_MAX + 1))
MULTITHREAD SAFETY LEVEL
Safe.
PORTING ISSUES
No problems expected.
PORTABILITY
FreeBSD 5 and up. Linux. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022. Windows Server 2025.
AVAILABILITY
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition
SEE ALSO
PTC MKS Toolkit 10.5 Documentation Build 40.