41
41
typedef struct RNG RNG;
43
struct RNG* rng_new (unsigned int seed);
44
void rng_free (struct RNG* rng);
46
void rng_seed (struct RNG* rng, unsigned int seed);
47
void rng_srandom(struct RNG *rng, unsigned int seed);
48
int rng_getInt (struct RNG* rng);
49
double rng_getDouble (struct RNG* rng);
50
float rng_getFloat (struct RNG* rng);
51
void rng_shuffleArray(struct RNG *rng, void *data, int elemSize, int numElems);
53
/** Note that skipping is as slow as generating n numbers! */
54
void rng_skip (struct RNG *rng, int n);
56
/** Seed the random number generator */
57
void BLI_srand (unsigned int seed);
59
/** Better seed for the random number generator, using noise.c hash[] */
60
void BLI_srandom (unsigned int seed);
62
/** Return a pseudo-random number N where 0<=N<(2^31) */
65
/** Return a pseudo-random number N where 0.0<=N<1.0 */
66
double BLI_drand (void);
68
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
69
float BLI_frand (void);
71
/** Fills a block of memory starting at \a addr
72
* and extending \a len bytes with pseudo-random
73
* contents. This routine does not use nor modify
74
* the state of the BLI random number generator.
76
void BLI_fillrand (void *addr, int len);
78
/** Shuffle an array randomly using the given seed.
79
* contents. This routine does not use nor modify
80
* the state of the BLI random number generator.
82
void BLI_array_randomize (void *data, int elemSize, int numElems, unsigned int seed);
85
/** Better seed for the random number generator, using noise.c hash[] */
86
/** Allows up to BLENDER_MAX_THREADS threads to address */
87
void BLI_thread_srandom (int thread, unsigned int seed);
89
/** Return a pseudo-random number N where 0<=N<(2^31) */
90
/** Allows up to BLENDER_MAX_THREADS threads to address */
91
int BLI_thread_rand (int thread);
93
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
94
/** Allows up to BLENDER_MAX_THREADS threads to address */
95
float BLI_thread_frand (int thread);
43
struct RNG *BLI_rng_new(unsigned int seed);
44
void BLI_rng_free(struct RNG *rng);
46
void BLI_rng_seed(struct RNG *rng, unsigned int seed);
47
void BLI_rng_srandom(struct RNG *rng, unsigned int seed);
48
int BLI_rng_get_int(struct RNG *rng);
49
double BLI_rng_get_double(struct RNG *rng);
50
float BLI_rng_get_float(struct RNG *rng);
51
void BLI_rng_shuffle_array(struct RNG *rng, void *data, int elemSize, int numElems);
53
/** Note that skipping is as slow as generating n numbers! */
54
void BLI_rng_skip(struct RNG *rng, int n);
56
/** Seed the random number generator */
57
void BLI_srand(unsigned int seed);
59
/** Better seed for the random number generator, using noise.c hash[] */
60
void BLI_srandom(unsigned int seed);
62
/** Return a pseudo-random number N where 0<=N<(2^31) */
65
/** Return a pseudo-random number N where 0.0<=N<1.0 */
66
double BLI_drand(void);
68
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
69
float BLI_frand(void);
71
/** Fills a block of memory starting at \a addr
72
* and extending \a len bytes with pseudo-random
73
* contents. This routine does not use nor modify
74
* the state of the BLI random number generator.
76
void BLI_fillrand(void *addr, int len);
78
/** Shuffle an array randomly using the given seed.
79
* contents. This routine does not use nor modify
80
* the state of the BLI random number generator.
82
void BLI_array_randomize(void *data, int elemSize, int numElems, unsigned int seed);
85
/** Better seed for the random number generator, using noise.c hash[] */
86
/** Allows up to BLENDER_MAX_THREADS threads to address */
87
void BLI_thread_srandom(int thread, unsigned int seed);
89
/** Return a pseudo-random number N where 0<=N<(2^31) */
90
/** Allows up to BLENDER_MAX_THREADS threads to address */
91
int BLI_thread_rand(int thread);
93
/** Return a pseudo-random number N where 0.0f<=N<1.0f */
94
/** Allows up to BLENDER_MAX_THREADS threads to address */
95
float BLI_thread_frand(int thread);
97
#endif /* __BLI_RAND_H__ */