|
Blender V4.3
|
Random number functions. More...
Go to the source code of this file.
Typedefs | |
| typedef struct RNG | RNG |
| typedef struct RNG_THREAD_ARRAY | RNG_THREAD_ARRAY |
Random number functions.
Definition in file BLI_rand.h.
| typedef struct RNG RNG |
Definition at line 25 of file BLI_rand.h.
| typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY |
Definition at line 28 of file BLI_rand.h.
Fill an array with random numbers.
Definition at line 169 of file rand.cc.
References BLI_rng_get_float(), BLI_rng_srandom(), count, and seed.
| void BLI_array_randomize | ( | void * | data, |
| unsigned int | elem_size, | ||
| unsigned int | elem_num, | ||
| 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 188 of file rand.cc.
References BLI_rng_seed(), BLI_rng_shuffle_array(), and seed.
Referenced by edbm_select_random_exec(), lattice_select_random_exec(), modify_mesh(), blender::ed::object::object_select_random_exec(), psys_thread_context_init_distribute(), random_heap_helper(), random_heap_reinsert_helper(), random_heapsimple_helper(), and testbuffer_list_data_randomize().
Definition at line 196 of file rand.cc.
References BLI_rng_seed(), BLI_rng_shuffle_bitmap(), and seed.
Referenced by curve_select_random_exec().
Return the _n_th number of the given low-discrepancy sequence.
Definition at line 284 of file rand.cc.
References double(), and halton_ex().
Definition at line 295 of file rand.cc.
References double(), and halton_ex().
Referenced by blender::deform_drawing(), and blender::eevee::Sampling::step().
Return the whole low-discrepancy sequence up to n.
Definition at line 322 of file rand.cc.
References double(), and halton_ex().
Definition at line 308 of file rand.cc.
References double(), and halton_ex().
Referenced by blender::get_rand_matrix(), blender::modify_stroke_random(), and blender::eevee::Sampling::step().
Definition at line 350 of file rand.cc.
References radical_inverse().
Referenced by hammersley_create().
Definition at line 355 of file rand.cc.
References double(), and radical_inverse().
Return a pseudo-random (hash) float from an integer value
Definition at line 180 of file rand.cc.
References BLI_rng_get_float(), BLI_rng_srandom(), and seed.
Referenced by modify_mesh().
| void BLI_rng_free | ( | struct RNG * | rng | ) |
Definition at line 58 of file rand.cc.
Referenced by BKE_brush_system_exit(), BKE_effectors_free(), BKE_mesh_remap_calc_faces_from_mesh(), BKE_particle_init_rng(), BLI_jitter_init(), bmo_subdivide_edges_exec(), brush_add(), brush_add_count_iter_free(), cloth_build_springs(), createFacepa(), blender::compositor::ScreenLensDistortionOperation::deinit_execution(), distribute_simple_children(), do_map(), dynamics_step(), find_nearest_points_test(), hammersley_create(), init_keys(), init_mv_jit(), int4_ghash_tests(), int4_map_tests(), make_duplis_particle_system(), modify_mesh(), multi_small_ghash_tests(), Freestyle::Noise::Noise(), blender::ed::object::object_rand_transverts(), particles_fluid_step(), PE_free_random_generator(), pointcloud_random(), postTrans(), psys_tasks_free(), psys_thread_context_init_distribute(), randint_ghash_tests(), randint_map_tests(), random_chunk_generate(), random_chunk_mutate_helper(), random_data_mutate_helper(), select_random_exec(), select_random_metaelems_exec(), sort_bmelem_flag(), utf8_as_char32_test_at_buffer_size(), and blender::geometry::ParamHandle::~ParamHandle().
| void BLI_rng_get_char_n | ( | RNG * | rng, |
| char * | bytes, | ||
| size_t | bytes_len ) |
Definition at line 88 of file rand.cc.
References blender::RandomNumberGenerator::get_double(), and RNG::rng.
Referenced by BLI_jitter_init(), hammersley_create(), and particles_fluid_step().
Definition at line 93 of file rand.cc.
References blender::RandomNumberGenerator::get_float(), and RNG::rng.
Referenced by basic_force_cb(), BKE_brush_jitter_pos(), BKE_brush_randomize_texture_coords(), BKE_particle_init_rng(), BLI_array_frand(), BLI_hash_frand(), BLI_thread_frand(), bmo_subdivide_edges_exec(), boid_body(), brush_add_count_iter(), brush_cut(), calculatePropRatio(), collision_response(), createFacepa(), distribute_children_exec(), distribute_from_faces_exec(), distribute_from_volume_exec(), distribute_simple_children(), find_internal_spring_target_vertex(), init_mv_jit(), blender::ed::object::object_rand_transverts(), blender::geometry::p_chart_stretch_minimize(), pointcloud_random(), psys_thread_context_init_distribute(), rng_v3_round(), rule_average_speed(), rule_avoid_collision(), rule_fight(), select_random_exec(), select_random_metaelems_exec(), sort_bmelem_flag(), weightvg_do_map(), and wind_func().
Referenced by blender::ed::object::object_rand_transverts().
Definition at line 78 of file rand.cc.
References blender::RandomNumberGenerator::get_int32(), and RNG::rng.
Referenced by BKE_particle_init_rng(), BLI_rng_thread_rand(), BLI_thread_rand(), make_duplis_particle_system(), multi_small_ghash_tests(), Freestyle::Noise::Noise(), and wind_func().
| void void void BLI_rng_get_tri_sample_float_v2 | ( | struct RNG * | rng, |
| const float | v1[2], | ||
| const float | v2[2], | ||
| const float | v3[2], | ||
| float | r_pt[2] ) |
Generate a random point inside given tri.
Definition at line 108 of file rand.cc.
References copy_v2_v2(), blender::RandomNumberGenerator::get_triangle_sample(), RNG::rng, and v2.
Referenced by BKE_mesh_remap_calc_faces_from_mesh().
| void BLI_rng_get_tri_sample_float_v3 | ( | RNG * | rng, |
| const float | v1[3], | ||
| const float | v2[3], | ||
| const float | v3[3], | ||
| float | r_pt[3] ) |
Definition at line 114 of file rand.cc.
References copy_v3_v3(), blender::RandomNumberGenerator::get_triangle_sample_3d(), RNG::rng, and v2.
Definition at line 83 of file rand.cc.
References blender::RandomNumberGenerator::get_uint32(), and RNG::rng.
Referenced by BLI_rng_shuffle_array(), BLI_rng_shuffle_bitmap(), BLI_thread_srandom(), init_keys(), int4_ghash_tests(), int4_map_tests(), multi_small_ghash_tests_one(), rand_range_i(), randint_ghash_tests(), randint_map_tests(), and testbuffer_list_state_random_data().
Definition at line 39 of file rand.cc.
References RNG::rng, blender::RandomNumberGenerator::seed(), and seed.
Referenced by BKE_brush_system_init(), BKE_mesh_remap_calc_faces_from_mesh(), BLI_jitter_init(), calculatePropRatio(), find_nearest_points_test(), hammersley_create(), blender::compositor::ScreenLensDistortionOperation::init_execution(), init_keys(), init_mv_jit(), int4_ghash_tests(), int4_map_tests(), multi_small_ghash_tests(), Freestyle::Noise::Noise(), blender::ed::object::object_rand_transverts(), PE_create_random_generator(), pointcloud_random(), precalculate_effector(), psys_task_init_distribute(), psys_task_init_path(), randint_ghash_tests(), randint_map_tests(), random_chunk_generate(), random_chunk_mutate_helper(), random_data_mutate_helper(), utf8_as_char32_test_at_buffer_size(), and blender::geometry::uv_parametrizer_stretch_begin().
A version of BLI_rng_new that hashes the seed.
Definition at line 46 of file rand.cc.
References RNG::rng, seed, and blender::RandomNumberGenerator::seed_random().
Referenced by BKE_particle_init_rng(), bmo_subdivide_edges_exec(), brush_add(), brush_add_count_iter(), cloth_build_springs(), createFacepa(), distribute_simple_children(), do_map(), dynamics_step(), make_duplis_particle_system(), modify_mesh(), particles_fluid_step(), psys_thread_context_init_distribute(), select_random_exec(), select_random_metaelems_exec(), and sort_bmelem_flag().
Definition at line 63 of file rand.cc.
References RNG::rng, blender::RandomNumberGenerator::seed(), and seed.
Referenced by BLI_array_randomize(), BLI_bitmap_randomize(), and BLI_thread_srandom().
| void BLI_rng_shuffle_array | ( | struct RNG * | rng, |
| void * | data, | ||
| unsigned int | elem_size_i, | ||
| unsigned int | elem_num ) |
Referenced by random_chunk_mutate_helper().
Note that skipping is as slow as generating n numbers! Simulate getting n random values.
Definition at line 162 of file rand.cc.
References RNG::rng, and blender::RandomNumberGenerator::skip().
Referenced by distribute_children_exec(), distribute_from_faces_exec(), distribute_from_verts_exec(), distribute_from_volume_exec(), exec_distribute_child(), and exec_distribute_parent().
Use a hash table to create better seed.
Definition at line 68 of file rand.cc.
References RNG::rng, seed, and blender::RandomNumberGenerator::seed_random().
Referenced by BKE_brush_system_init(), BLI_array_frand(), BLI_hash_frand(), and BLI_rng_threaded_new().
| int BLI_rng_thread_rand | ( | RNG_THREAD_ARRAY * | rngarr, |
| int | thread ) |
Definition at line 253 of file rand.cc.
References BLI_rng_get_int(), and RNG_THREAD_ARRAY::rng_tab.
Referenced by texnoise().
| void BLI_rng_threaded_free | ( | struct RNG_THREAD_ARRAY * | rngarr | ) |
Definition at line 248 of file rand.cc.
References MEM_freeN().
Referenced by RE_texture_rng_exit().
| RNG_THREAD_ARRAY * BLI_rng_threaded_new | ( | void | ) |
array versions for thread safe random generation
Definition at line 235 of file rand.cc.
References BLENDER_MAX_THREADS, BLI_rng_srandom(), MEM_mallocN, and RNG_THREAD_ARRAY::rng_tab.
Referenced by RE_texture_rng_init().
Return a pseudo-random number N where 0.0f<=N<1.0f Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 226 of file rand.cc.
References BLI_rng_get_float(), and rng_tab.
Referenced by ED_region_do_draw().
Return a pseudo-random number N where 0<=N<(2^31) Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 221 of file rand.cc.
References BLI_rng_get_int(), and rng_tab.
Better seed for the random number generator, using noise.cc hash[] Allows up to BLENDER_MAX_THREADS threads to address
Definition at line 208 of file rand.cc.
References BLENDER_MAX_THREADS, BLI_rng_get_uint(), BLI_rng_seed(), hash, rng_tab, and seed.