diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-20 12:29:33 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-06-20 12:30:25 +0300 |
commit | 8b673fc75f2a7dd4e874d20e9b5e45fa7025eaf5 (patch) | |
tree | 945112d17c89f6bfa0bb626cc94f4f8751e603c6 /source/blender/blenlib | |
parent | d97ee0b06a8ca7d62355c4f281dc5a1984b5e0f6 (diff) |
Cleanup: get rid of last non-thread-safe BLI_frand random generator func.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_rand.h | 4 | ||||
-rw-r--r-- | source/blender/blenlib/intern/rand.c | 20 |
2 files changed, 0 insertions, 24 deletions
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; |