[Bf-blender-cvs] [8b673fc75f2] blender2.8: Cleanup: get rid of last non-thread-safe BLI_frand random generator func.

Bastien Montagne noreply at git.blender.org
Wed Jun 20 11:30:35 CEST 2018


Commit: 8b673fc75f2a7dd4e874d20e9b5e45fa7025eaf5
Author: Bastien Montagne
Date:   Wed Jun 20 11:29:33 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB8b673fc75f2a7dd4e874d20e9b5e45fa7025eaf5

Cleanup: get rid of last non-thread-safe BLI_frand random generator func.

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

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 9029fff60e5..612151b7ea2 100644
--- a/source/blender/blenlib/BLI_rand.h
+++ b/source/blender/blenlib/BLI_rand.h
@@ -64,10 +64,6 @@ 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);
 
-/** 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;
-
 /** 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 75b50caf367..9e56ce6b2cf 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -265,26 +265,6 @@ void BLI_rng_skip(RNG *rng, int n)
 
 /***/
 
-/* initialize with some non-zero seed */
-static RNG theBLI_rng = {611330372042337130};
-
-static void ensure_rng_thread_safe(void)
-{
-	/* TODO(sergey): Ideally we will get rid of all rng functions which
-	 * are using global generator. But for until then we need some way to
-	 * catch "bad" calls at runtime.
-	 *
-	 * NOTE: Lots of areas are not ported, so we keep check disabled for now.
-	 */
-	// BLI_assert(BLI_thread_is_main());
-}
-
-float BLI_frand(void)
-{
-	ensure_rng_thread_safe();
-	return BLI_rng_get_float(&theBLI_rng);
-}
-
 float BLI_hash_frand(unsigned int seed)
 {
 	RNG rng;



More information about the Bf-blender-cvs mailing list