|
Blender
V2.59
|
Random number functions. More...
Go to the source code of this file.
Typedefs | |
| typedef struct RNG | RNG |
Functions | |
| struct RNG * | rng_new (unsigned int seed) |
| void | rng_free (struct RNG *rng) |
| void | rng_seed (struct RNG *rng, unsigned int seed) |
| void | rng_srandom (struct RNG *rng, unsigned int seed) |
| int | rng_getInt (struct RNG *rng) |
| double | rng_getDouble (struct RNG *rng) |
| float | rng_getFloat (struct RNG *rng) |
| void | rng_shuffleArray (struct RNG *rng, void *data, int elemSize, int numElems) |
| void | rng_skip (struct RNG *rng, int n) |
| void | BLI_srand (unsigned int seed) |
| void | BLI_srandom (unsigned int seed) |
| int | BLI_rand (void) |
| double | BLI_drand (void) |
| float | BLI_frand (void) |
| void | BLI_fillrand (void *addr, int len) |
| void | BLI_array_randomize (void *data, int elemSize, int numElems, unsigned int seed) |
| void | BLI_thread_srandom (int thread, unsigned int seed) |
| int | BLI_thread_rand (int thread) |
| float | BLI_thread_frand (int thread) |
Random number functions.
Definition in file BLI_rand.h.
Definition at line 43 of file BLI_rand.h.
| void BLI_array_randomize | ( | void * | data, |
| int | elemSize, | ||
| int | numElems, | ||
| unsigned int | seed | ||
| ) |
Shuffle an array randomly using the given seed. contents. This routine does not use nor modify the state of the BLI random number generator.
Definition at line 169 of file rand.c.
References rng_seed(), and rng_shuffleArray().
Referenced by applyModifier(), distribute_threads_init_data(), isb_add_samples(), and isb_add_samples_transp().
| double BLI_drand | ( | void | ) |
Return a pseudo-random number N where 0.0<=N<1.0
Definition at line 153 of file rand.c.
References rng_getDouble().
Referenced by alter_co(), BLI_initjit(), hashvert_flag(), rand_timeoffs(), and RE_make_stars().
| void BLI_fillrand | ( | void * | addr, |
| int | len | ||
| ) |
Fills a block of memory starting at addr and extending len bytes with pseudo-random contents. This routine does not use nor modify the state of the BLI random number generator.
Definition at line 161 of file rand.c.
References p, PIL_check_seconds_timer(), rng_getInt(), and rng_seed().
| float BLI_frand | ( | void | ) |
Return a pseudo-random number N where 0.0f<=N<1.0f
Definition at line 157 of file rand.c.
References rng_getFloat().
Referenced by applyModifier(), basic_force_cb(), boid_body(), brush_add(), brush_cut(), brush_jitter_pos(), calculatePropRatio(), collision_response(), createFacepa(), defocus_blur(), distribute_simple_children(), distribute_threads_exec(), distribute_threads_init_data(), image_buffer_rect_update(), IMB_partial_rect_from_float(), IMB_rect_from_float(), init_jitter_plane(), lensDistort(), object_select_random_exec(), psys_create_frand(), RandomSpherical(), rule_average_speed(), rule_avoid_collision(), rule_fight(), sculpt_update_cache_variants(), select_random_metaelems_exec(), selectrandom_curve(), selectrandom_mesh(), and sort_faces_exec().
| int BLI_rand | ( | void | ) |
Return a pseudo-random number N where 0<=N<(2^31)
Definition at line 149 of file rand.c.
References rng_getInt().
Referenced by calculatePropRatio(), defocus_blur(), new_particle_duplilist(), select_random_metaelems_exec(), selectrandom_curve(), selectrandom_mesh(), and texnoise().
| void BLI_srand | ( | unsigned int | seed | ) |
Seed the random number generator
Definition at line 140 of file rand.c.
References rng_seed().
Referenced by BLI_initjit(), calculatePropRatio(), hashvert_flag(), RE_make_stars(), select_random_metaelems_exec(), selectrandom_curve(), and selectrandom_mesh().
| void BLI_srandom | ( | unsigned int | seed | ) |
Better seed for the random number generator, using noise.c hash[]
Definition at line 145 of file rand.c.
References rng_srandom().
Referenced by applyModifier(), brush_add(), createFacepa(), distribute_threads_init_data(), do_render_composite_fields_blur_3d(), dynamics_step(), init_ao_sphere(), init_jitter_plane(), new_particle_duplilist(), ntreeCompositExecTree(), and psys_create_frand().
| float BLI_thread_frand | ( | int | thread | ) |
Return a pseudo-random number N where 0.0f<=N<1.0f Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 197 of file rand.c.
References rng_getFloat().
Referenced by give_jitter_plane(), QMC_initPixel(), sphere_sampler(), vol_get_transmittance(), and volumeintegrate().
| int BLI_thread_rand | ( | int | thread | ) |
Return a pseudo-random number N where 0<=N<(2^31) Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 193 of file rand.c.
References rng_getInt().
| void BLI_thread_srandom | ( | int | thread, |
| unsigned int | seed | ||
| ) |
Better seed for the random number generator, using noise.c hash[] Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 181 of file rand.c.
References BLENDER_MAX_THREADS, hash, rng_getInt(), and rng_seed().
Referenced by shadeDA_tile(), strand_shade_point(), zbufshade_sss_tile(), and zbufshade_tile().
| void rng_free | ( | struct RNG * | rng | ) |
Definition at line 78 of file rand.c.
References MEM_freeN().
Referenced by free_partdeflect(), hammersley_create(), init_mv_jit(), param_stretch_end(), psys_threads_free(), and render_new_particle_system().
| double rng_getDouble | ( | struct RNG * | rng | ) |
Definition at line 100 of file rand.c.
References rng_getInt().
Referenced by BLI_drand(), and hammersley_create().
| float rng_getFloat | ( | struct RNG * | rng | ) |
Definition at line 104 of file rand.c.
References rng_getInt().
Referenced by BLI_frand(), BLI_thread_frand(), distribute_threads_exec(), init_mv_jit(), p_chart_stretch_minimize(), render_new_particle_system(), and wind_func().
| int rng_getInt | ( | struct RNG * | rng | ) |
Definition at line 95 of file rand.c.
References ADDEND, MASK, MULTIPLIER, and RNG::X.
Referenced by BLI_fillrand(), BLI_rand(), BLI_thread_rand(), BLI_thread_srandom(), rng_getDouble(), rng_getFloat(), rng_shuffleArray(), rng_skip(), rng_srandom(), and wind_func().
| struct RNG* rng_new | ( | unsigned int | seed | ) | [read] |
Definition at line 69 of file rand.c.
References MEM_mallocN(), and rng_seed().
Referenced by distribute_threads_init_data(), hammersley_create(), init_mv_jit(), param_stretch_begin(), precalculate_effector(), psys_threads_init_path(), and render_new_particle_system().
| void rng_seed | ( | struct RNG * | rng, |
| unsigned int | seed | ||
| ) |
Definition at line 83 of file rand.c.
References LOWSEED, and RNG::X.
Referenced by BLI_array_randomize(), BLI_fillrand(), BLI_srand(), BLI_thread_srandom(), rng_new(), and rng_srandom().
| void rng_shuffleArray | ( | struct RNG * | rng, |
| void * | data, | ||
| int | elemSize, | ||
| int | numElems | ||
| ) |
Definition at line 108 of file rand.c.
References i, and rng_getInt().
Referenced by BLI_array_randomize().
| void rng_skip | ( | struct RNG * | rng, |
| int | n | ||
| ) |
Note that skipping is as slow as generating n numbers!
Definition at line 127 of file rand.c.
References i, and rng_getInt().
Referenced by distribute_threads_exec(), and distribute_threads_exec_cb().
| void rng_srandom | ( | struct RNG * | rng, |
| unsigned int | seed | ||
| ) |
Definition at line 87 of file rand.c.
References hash, rng_getInt(), and rng_seed().
Referenced by BLI_srandom(), and precalculate_effector().