Commit: b236400ff5b6b18f0b81fb326b95719be7ebe379
Author: Sergey Sharybin
Date:   Tue Jun 12 15:46:50 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBb236400ff5b6b18f0b81fb326b95719be7ebe379

Math: Remove unused functions which are not safe for threading

All areas are toy use "local" number generator, in order to keep
behavior predictable and threadable. This is what BLI_rng_() API
is for.

There are still lots of usages of BLI_frand(), which are to be
ported to BLI_rng_get_float(). but that is somewhat involved.

For the time being, remove unsafe API, so new areas have zero
chance using it.

===================================================================

M       source/blender/blenlib/BLI_rand.h
M       source/blender/blenlib/intern/rand.c

===================================================================

diff --git a/source/blender/blenlib/BLI_rand.h 
b/source/blender/blenlib/BLI_rand.h
index 69b23b2473f..811a6ba1768 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -64,15 +64,9 @@ void        BLI_rng_shuffle_array(struct RNG *rng, void 
*data, unsigned int elem
 /** Note that skipping is as slow as generating n numbers! */
 void        BLI_rng_skip(struct RNG *rng, int n) ATTR_NONNULL(1);
 
-/** Seed for the random number generator, using noise.c hash[] */
-void    BLI_srandom(unsigned int seed);
-
-/** Return a pseudo-random number N where 0<=N<(2^31) */
-int     BLI_rand(void) ATTR_WARN_UNUSED_RESULT;
-
 /** Return a pseudo-random number N where 0.0f<=N<1.0f */
+/* !!!!! NOTE: DO NOT USE IT IN NEW CODE !!!!! */
 float   BLI_frand(void) ATTR_WARN_UNUSED_RESULT;
-void    BLI_frand_unit_v3(float v[3]);
 
 /** Return a pseudo-random (hash) float from an integer value */
 float  BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT;
diff --git a/source/blender/blenlib/intern/rand.c 
b/source/blender/blenlib/intern/rand.c
index 8d6f55c9ae5..557f0d79270 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -279,30 +279,12 @@ static void ensure_rng_thread_safe(void)
        // BLI_assert(BLI_thread_is_main());
 }
 
-void BLI_srandom(unsigned int seed)
-{
-       ensure_rng_thread_safe();
-       BLI_rng_srandom(&theBLI_rng, seed);
-}
-
-int BLI_rand(void)
-{
-       ensure_rng_thread_safe();
-       return BLI_rng_get_int(&theBLI_rng);
-}
-
 float BLI_frand(void)
 {
        ensure_rng_thread_safe();
        return BLI_rng_get_float(&theBLI_rng);
 }
 
-void BLI_frand_unit_v3(float v[3])
-{
-       ensure_rng_thread_safe();
-       BLI_rng_get_float_unit_v3(&theBLI_rng, v);
-}
-
 float BLI_hash_frand(unsigned int seed)
 {
        RNG rng;

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to