diff options
Diffstat (limited to 'source/blender/blenlib/BLI_rand.h')
-rw-r--r-- | source/blender/blenlib/BLI_rand.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_rand.h b/source/blender/blenlib/BLI_rand.h index c86b3aea503..7b84dddcb68 100644 --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@ -40,6 +40,9 @@ struct RNG; typedef struct RNG RNG; +struct RNG_THREAD_ARRAY; +typedef struct RNG_THREAD_ARRAY RNG_THREAD_ARRAY; + struct RNG *BLI_rng_new(unsigned int seed); struct RNG *BLI_rng_new_srandom(unsigned int seed); void BLI_rng_free(struct RNG *rng) ATTR_NONNULL(1); @@ -52,6 +55,9 @@ double BLI_rng_get_double(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NON float BLI_rng_get_float(struct RNG *rng) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1); void BLI_rng_get_float_unit_v2(struct RNG *rng, float v[2]) ATTR_NONNULL(1, 2); void BLI_rng_get_float_unit_v3(struct RNG *rng, float v[3]) ATTR_NONNULL(1, 2); +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]) ATTR_NONNULL(); void BLI_rng_shuffle_array(struct RNG *rng, void *data, unsigned int elem_size_i, unsigned int elem_tot) ATTR_NONNULL(1, 2); /** Note that skipping is as slow as generating n numbers! */ @@ -89,4 +95,9 @@ int BLI_thread_rand(int thread) ATTR_WARN_UNUSED_RESULT; /** Allows up to BLENDER_MAX_THREADS threads to address */ float BLI_thread_frand(int thread) ATTR_WARN_UNUSED_RESULT; +/** array versions for thread safe random generation */ +RNG_THREAD_ARRAY *BLI_rng_threaded_new(void); +void BLI_rng_threaded_free(struct RNG_THREAD_ARRAY *rngarr) ATTR_NONNULL(1); +int BLI_rng_thread_rand(RNG_THREAD_ARRAY *rngarr, int thread) ATTR_WARN_UNUSED_RESULT; + #endif /* __BLI_RAND_H__ */ |