VLC  3.0.15
Functions | Variables
rand.c File Reference
Include dependency graph for rand.c:

Functions

static void init_rand48 (void)
 
double vlc_drand48 (void)
 PRNG uniformly distributed between 0.0 and 1.0 with 48-bits precision. More...
 
long vlc_lrand48 (void)
 PRNG uniformly distributed between 0 and 2^32 - 1. More...
 
long vlc_mrand48 (void)
 PRNG uniformly distributed between -2^32 and 2^32 - 1. More...
 

Variables

struct {
   bool   init
 
   unsigned short   subi [3]
 
   vlc_mutex_t   lock
 
rand48 = { false, { 0, 0, 0, }, PTHREAD_MUTEX_INITIALIZER , }
 

Function Documentation

◆ init_rand48()

static void init_rand48 ( void  )
static

References rand48, subi, and vlc_rand_bytes().

Referenced by vlc_drand48(), vlc_lrand48(), and vlc_mrand48().

◆ vlc_drand48()

double vlc_drand48 ( void  )

PRNG uniformly distributed between 0.0 and 1.0 with 48-bits precision.

Note
Contrary to POSIX drand48(), this function is thread-safe.
Warning
Series generated by this function are not reproducible. Use erand48() if you need reproducible series.
Returns
a double value within [0.0, 1.0] inclusive

References erand48(), init_rand48(), rand48, vlc_mutex_lock(), and vlc_mutex_unlock().

◆ vlc_lrand48()

long vlc_lrand48 ( void  )

PRNG uniformly distributed between 0 and 2^32 - 1.

Note
Contrary to POSIX lrand48(), this function is thread-safe.
Warning
Series generated by this function are not reproducible. Use nrand48() if you need reproducible series.
Returns
an integral value within [0.0, 2^32-1] inclusive

References init_rand48(), nrand48(), rand48, vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by ResetCurrentlyPlaying().

◆ vlc_mrand48()

long vlc_mrand48 ( void  )

PRNG uniformly distributed between -2^32 and 2^32 - 1.

Note
Contrary to POSIX mrand48(), this function is thread-safe.
Warning
Series generated by this function are not reproducible. Use jrand48() if you need reproducible series.
Returns
an integral value within [-2^32, 2^32-1] inclusive

References init_rand48(), jrand48(), rand48, vlc_mutex_lock(), and vlc_mutex_unlock().

Referenced by playlist_ItemArraySort().

Variable Documentation

◆ init

bool init

Referenced by module_load().

◆ lock

Referenced by vlc_rand_bytes().

◆ rand48

struct { ... } rand48

◆ subi

unsigned short subi[3]

Referenced by init_rand48().