|
Blender
V2.93
|
#include <BLI_rand.hh>
Public Member Functions | |
| RandomNumberGenerator (uint32_t seed=0) | |
| void | seed (uint32_t seed) |
| void | seed_random (uint32_t seed) |
| uint32_t | get_uint32 () |
| int32_t | get_int32 () |
| int32_t | get_int32 (int32_t max_exclusive) |
| double | get_double () |
| float | get_float () |
| template<typename T > | |
| void | shuffle (MutableSpan< T > values) |
| float3 | get_barycentric_coordinates () |
| float2 | get_unit_float2 () |
| float3 | get_unit_float3 () |
| float2 | get_triangle_sample (float2 v1, float2 v2, float2 v3) |
| float3 | get_triangle_sample_3d (float3 v1, float3 v2, float3 v3) |
| void | get_bytes (MutableSpan< char > r_bytes) |
| void | skip (int64_t n) |
Definition at line 31 of file BLI_rand.hh.
|
inline |
Definition at line 36 of file BLI_rand.hh.
References seed().
|
inline |
Compute uniformly distributed barycentric coordinates.
Definition at line 105 of file BLI_rand.hh.
References get_float().
Referenced by blender::nodes::sample_mesh_surface().
| void blender::RandomNumberGenerator::get_bytes | ( | MutableSpan< char > | r_bytes | ) |
Definition at line 453 of file rand.cc.
References BLI_assert, and blender::MutableSpan< T >::size().
Referenced by BLI_rng_get_char_n().
|
inline |
Definition at line 76 of file BLI_rand.hh.
References get_int32().
Referenced by BLI_rng_get_double().
|
inline |
Definition at line 84 of file BLI_rand.hh.
References get_int32().
Referenced by BLI_rng_get_float(), get_barycentric_coordinates(), get_triangle_sample(), get_triangle_sample_3d(), get_unit_float2(), get_unit_float3(), blender::nodes::sample_mesh_surface(), and blender::bke::tests::test_lattice_deform_init().
|
inline |
Definition at line 58 of file BLI_rand.hh.
References x_.
Referenced by BLI_rng_get_int(), generate_unique_instance_ids(), get_double(), get_float(), get_int32(), shuffle(), and blender::tests::TEST().
Definition at line 67 of file BLI_rand.hh.
References BLI_assert, and get_int32().
Generate a random point inside the given triangle.
Definition at line 415 of file rand.cc.
References get_float(), blender::compositor::sample(), v, v1, and v2.
Referenced by BLI_rng_get_tri_sample_float_v2().
Definition at line 434 of file rand.cc.
References get_float(), blender::compositor::sample(), v, v1, and v2.
Referenced by BLI_rng_get_tri_sample_float_v3().
|
inline |
Definition at line 52 of file BLI_rand.hh.
References x_.
Referenced by BLI_rng_get_uint(), blender::nodes::get_geometry_element_ids_as_uints(), and seed_random().
| float2 blender::RandomNumberGenerator::get_unit_float2 | ( | ) |
Definition at line 392 of file rand.cc.
References Freestyle::a, cosf, float(), get_float(), M_PI, and sinf.
Referenced by BLI_rng_get_float_unit_v2().
| float3 blender::RandomNumberGenerator::get_unit_float3 | ( | ) |
Definition at line 398 of file rand.cc.
References Freestyle::a, cosf, float(), get_float(), M_PI, r, sinf, sqrtf, x, y, and z.
Referenced by BLI_rng_get_float_unit_v3().
|
inline |
Set the seed for future random numbers.
Definition at line 44 of file BLI_rand.hh.
References x_.
Referenced by BLI_rng_new(), BLI_rng_seed(), RandomNumberGenerator(), and seed_random().
| void blender::RandomNumberGenerator::seed_random | ( | uint32_t | seed | ) |
Set a randomized hash of the value as seed.
Definition at line 383 of file rand.cc.
References get_uint32(), hash, and seed().
Referenced by BLI_rng_new_srandom(), BLI_rng_srandom(), and generate_unique_instance_ids().
|
inline |
Definition at line 89 of file BLI_rand.hh.
References BLI_assert, get_int32(), INT32_MAX, blender::MutableSpan< T >::size(), and swap().
|
inline |
Simulate getting n random values.
Definition at line 127 of file BLI_rand.hh.
Referenced by BLI_rng_skip().