Rhino C++ API  8.13
Public Member Functions | Static Public Member Functions | List of all members
ON_RandomNumberGenerator Class Reference

#include <opennurbs_rand.h>

Public Member Functions

 ON_RandomNumberGenerator ()
 
double RandomDouble ()
 
double RandomDouble (const class ON_Interval &range)
 
double RandomDouble (double t0, double t1)
 
ON__UINT32 RandomNumber ()
 
void RandomPermutation (void *base, size_t nel, size_t sizeof_element)
 
int RandomSignedInteger (int i0, int i1)
 
unsigned int RandomUnsignedInteger (unsigned int i0, unsigned int i1)
 
void Seed ()
 
void Seed (ON__UINT32 s)
 
void TwoGaussians (double *u, double *v)
 

Static Public Member Functions

static ON__UINT32 RandomSeed ()
 

Constructor & Destructor Documentation

◆ ON_RandomNumberGenerator()

ON_RandomNumberGenerator::ON_RandomNumberGenerator ( )

Member Function Documentation

◆ RandomDouble() [1/3]

double ON_RandomNumberGenerator::RandomDouble ( )

Returns: double in the interval [0.0 and 1.0]

◆ RandomDouble() [2/3]

double ON_RandomNumberGenerator::RandomDouble ( const class ON_Interval range)

◆ RandomDouble() [3/3]

double ON_RandomNumberGenerator::RandomDouble ( double  t0,
double  t1 
)

Returns: double in the interval [t0,t1]

◆ RandomNumber()

ON__UINT32 ON_RandomNumberGenerator::RandomNumber ( )

Returns: 32 bit unsigned random number [0,0xFFFFFFFF] [0,4294967295]

◆ RandomPermutation()

void ON_RandomNumberGenerator::RandomPermutation ( void *  base,
size_t  nel,
size_t  sizeof_element 
)

Description: Perform a random permutation on an array. Parameters: base - [in/out] Array of element to permute nel - [in] number of elements in the array. sizeof_element size of an element in bytes.

◆ RandomSeed()

static ON__UINT32 ON_RandomNumberGenerator::RandomSeed ( )
static

Returns: A unpredictable seed value for a random number generator. This function is much slower than ON_RandomNumberGenerator::RandomNumber().

◆ RandomSignedInteger()

int ON_RandomNumberGenerator::RandomSignedInteger ( int  i0,
int  i1 
)

Parameters: i0 - [in] i1 - [in] Returns: A signed integer in the interval [min(i0,i1), max(i0,i1)], inclusive Example RandomSignedInteger(-2,3) will return -2, -1, 0, 1, 2, or 3.

◆ RandomUnsignedInteger()

unsigned int ON_RandomNumberGenerator::RandomUnsignedInteger ( unsigned int  i0,
unsigned int  i1 
)

Parameters: i0 - [in] i1 - [in] Returns: An unsigned integer in the interval [min(i0,i1), max(i0,i1)], inclusive Example RandomUnsignedInteger(3,7) will return 3, 4, 5, 6, or 7.

◆ Seed() [1/2]

void ON_RandomNumberGenerator::Seed ( )

Description: Seed the random number generator in a way that cannot be reproduced.

◆ Seed() [2/2]

void ON_RandomNumberGenerator::Seed ( ON__UINT32  s)

Description: Seed the random number generator. Parameters: s - [in]

◆ TwoGaussians()

void ON_RandomNumberGenerator::TwoGaussians ( double *  u,
double *  v 
)

Description: Places two Gaussians with mean zero and standard deviation one, generated by a Box-Muller transform, into the doubles pointed to by its arguments. Parameters: u - [out] v - [out] Returns: