Classes | Typedefs | Functions
random.h File Reference

Random number generator (Random number generator) More...

#include "host.h"
Include dependency graph for random.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _VlRand
 Random numbber generator state. More...

Typedefs

typedef struct _VlRand VlRand
 Random numbber generator state.

Functions

VL_EXPORT void vl_rand_permute_indexes (VlRand *self, vl_index *array, vl_size size)
 Randomly permute and array of indexes.
Setting and reading the state
VL_EXPORT void vl_rand_init (VlRand *self)
 Initialise random number generator.
VL_EXPORT void vl_rand_seed (VlRand *self, vl_uint32 s)
 Seed the state of the random number generator.
VL_EXPORT 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.
Generate random numbers
VL_INLINE vl_uint64 vl_rand_uint64 (VlRand *self)
 Generate a random UINT64.
VL_INLINE vl_int64 vl_rand_int63 (VlRand *self)
 Generate a random INT63.
VL_EXPORT vl_uint32 vl_rand_uint32 (VlRand *self)
 Generate a random UINT32.
VL_INLINE vl_int32 vl_rand_int31 (VlRand *self)
 Generate a random INT31.
VL_INLINE double vl_rand_real1 (VlRand *self)
 Generate a random number in [0,1].
VL_INLINE double vl_rand_real2 (VlRand *self)
 Generate a random number in [0,1)
VL_INLINE double vl_rand_real3 (VlRand *self)
 Generate a random number in (0,1)
VL_INLINE double vl_rand_res53 (VlRand *self)
 Generate a random number in [0,1) with 53-bit resolution.
VL_INLINE vl_uindex vl_rand_uindex (VlRand *self, vl_uindex range)
 Generate a random index in a given range.

Detailed Description

Random number generator (Random number generator)

Author:
Andrea Vedaldi
See also:
Random number generator

Definition in file random.h.


Typedef Documentation

typedef struct _VlRand VlRand

Random numbber generator state.


Function Documentation

VL_EXPORT void vl_rand_init ( VlRand self)

Initialise random number generator.

Parameters:
selfnumber generator.

Definition at line 132 of file random.c.

VL_INLINE vl_int32 vl_rand_int31 ( VlRand self)

Generate a random INT31.

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

Definition at line 106 of file random.h.

VL_INLINE vl_int64 vl_rand_int63 ( VlRand self)

Generate a random INT63.

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

Definition at line 95 of file random.h.

VL_EXPORT 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.

VL_INLINE double vl_rand_real1 ( VlRand self)

Generate a random number in [0,1].

Parameters:
selfrandom number generator.
Returns:
a random number.

Definition at line 117 of file random.h.

VL_INLINE double vl_rand_real2 ( VlRand self)

Generate a random number in [0,1)

Parameters:
selfrandom number generator.
Returns:
a random number.

Definition at line 129 of file random.h.

VL_INLINE double vl_rand_real3 ( VlRand self)

Generate a random number in (0,1)

Parameters:
selfrandom number generator.
Returns:
a random number.

Definition at line 141 of file random.h.

VL_INLINE double vl_rand_res53 ( VlRand self)

Generate a random number in [0,1) with 53-bit resolution.

Parameters:
selfrandom number generator.
Returns:
a random number.

Definition at line 153 of file random.h.

VL_EXPORT 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.

VL_EXPORT 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.

VL_INLINE vl_uindex vl_rand_uindex ( VlRand self,
vl_uindex  range 
)

Generate a random index in a given range.

Parameters:
selfrandom number generator.
rangerange.
Returns:
an index sampled uniformly at random in the interval [0, range - 1]
Remarks:
Currently, this function uses a simple algorithm that may yield slightly biased samples if range is not a power of two.

Definition at line 65 of file random.h.

VL_EXPORT vl_uint32 vl_rand_uint32 ( VlRand self)

Generate a random UINT32.

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

Definition at line 225 of file random.c.

VL_INLINE vl_uint64 vl_rand_uint64 ( VlRand self)

Generate a random UINT64.

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

Definition at line 82 of file random.h.



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