Defines | Functions
random.c File Reference

Random number generator - Definition. More...

#include "random.h"
#include <stdio.h>
#include <string.h>
Include dependency graph for random.c:

Go to the source code of this file.

Defines

#define LOWER_MASK   VL_UINT32_C(0x7fffffff) /* least significant r bits */
#define M   397
#define MATRIX_A   VL_UINT32_C(0x9908b0df) /* constant vector a */
#define mt   self->mt
#define mt   self->mt
#define mt   self->mt
#define mti   self->mti
#define mti   self->mti
#define mti   self->mti
#define N   624
#define UPPER_MASK   VL_UINT32_C(0x80000000) /* most asignificant w-r bits */

Functions

void vl_rand_init (VlRand *self)
 Initialise random number generator.
void vl_rand_permute_indexes (VlRand *self, vl_index *array, vl_size size)
 Randomly permute and array of indexes.
void vl_rand_seed (VlRand *self, vl_uint32 s)
 Seed the state of the random number generator.
void vl_rand_seed_by_array (VlRand *self, vl_uint32 const key[], vl_size keySize)
 Seed the state of the random number generator by an array.
vl_uint32 vl_rand_uint32 (VlRand *self)
 Generate a random UINT32.

Detailed Description

Random number generator - Definition.

Author:
Andrea Vedaldi

Definition in file random.c.


Define Documentation

#define LOWER_MASK   VL_UINT32_C(0x7fffffff) /* least significant r bits */

Definition at line 123 of file random.c.

#define M   397

Definition at line 120 of file random.c.

#define MATRIX_A   VL_UINT32_C(0x9908b0df) /* constant vector a */

Definition at line 121 of file random.c.

#define mt   self->mt
#define mt   self->mt
#define mt   self->mt
#define mti   self->mti
#define mti   self->mti
#define mti   self->mti
#define N   624

Definition at line 119 of file random.c.

#define UPPER_MASK   VL_UINT32_C(0x80000000) /* most asignificant w-r bits */

Definition at line 122 of file random.c.


Function Documentation

void vl_rand_init ( VlRand self)

Initialise random number generator.

Parameters:
selfnumber generator.

Definition at line 132 of file random.c.

void vl_rand_permute_indexes ( VlRand self,
vl_index array,
vl_size  size 
)

Randomly permute and array of indexes.

Parameters:
selfrandom number generator.
arrayarray of indexes.
sizenumber of element in the array.

The function uses *Algorithm P*, also known as *Knuth shuffle*.

Definition at line 208 of file random.c.

void vl_rand_seed ( VlRand self,
vl_uint32  s 
)

Seed the state of the random number generator.

Parameters:
selfrandom number generator.
sseed.

Definition at line 144 of file random.c.

void vl_rand_seed_by_array ( VlRand self,
vl_uint32 const  key[],
vl_size  keySize 
)

Seed the state of the random number generator by an array.

Parameters:
selfrandom number generator.
keyarray of numbers.
keySizelength of the array.

Definition at line 170 of file random.c.

Generate a random UINT32.

Parameters:
selfrandom number generator.
Returns:
a random number in [0, 0xffffffff].

Definition at line 225 of file random.c.



libvlfeat
Author(s): Andrea Vedaldi
autogenerated on Thu Jun 6 2019 20:25:52