Commit: 7b2c84031450cb93db558c0301eccf59913d9e3e Author: Antonio Vazquez Date: Tue Jun 12 18:43:26 2018 +0200 Branches: greasepencil-object https://developer.blender.org/rB7b2c84031450cb93db558c0301eccf59913d9e3e
Merge branch 'blender2.8' into greasepencil-object Conflicts: source/blender/blenlib/intern/rand.c =================================================================== =================================================================== diff --cc source/blender/blenlib/BLI_rand.h index c82017a1597,811a6ba1768..b1d64a4318c --- a/source/blender/blenlib/BLI_rand.h +++ b/source/blender/blenlib/BLI_rand.h @@@ -64,19 -64,10 +64,13 @@@ void BLI_rng_shuffle_array(struc /** 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]); +/* fill an array with random numbers */ +void BLI_array_frand(float *ar, int count, unsigned int seed); + /** Return a pseudo-random (hash) float from an integer value */ float BLI_hash_frand(unsigned int seed) ATTR_WARN_UNUSED_RESULT; diff --cc source/blender/blenlib/intern/rand.c index 73a1093771b,557f0d79270..72e7b09f823 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@@ -297,24 -285,6 +285,18 @@@ float BLI_frand(void 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); - } - +/* fill an array with random numbers */ +void BLI_array_frand(float *ar, int count, unsigned int seed) +{ + RNG rng; + + BLI_rng_srandom(&rng, seed); + + for (int i = 0; i < count; i++) { + ar[i] = BLI_rng_get_float(&rng); + } +} + 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