From 8b673fc75f2a7dd4e874d20e9b5e45fa7025eaf5 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 20 Jun 2018 11:29:33 +0200 Subject: Cleanup: get rid of last non-thread-safe BLI_frand random generator func. --- source/blender/blenlib/BLI_rand.h | 4 ---- source/blender/blenlib/intern/rand.c | 20 -------------------- 2 files changed, 24 deletions(-) (limited to 'source/blender/blenlib') 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; -- cgit v1.2.3