Cleanup: get rid of last non-thread-safe BLI_frand random generator func.
This commit is contained in:
parent
d97ee0b06a
commit
8b673fc75f
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue