diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-09-01 19:31:09 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-09-01 19:31:09 +0400 |
commit | 77e86dce2aa868f96467b1989f905cf9cb20de02 (patch) | |
tree | ee0b9acc693040029a3455b13819f0f020fef043 /source/blender/blenlib/intern/rand.c | |
parent | b18f77abfdc6553c5d86200062126cf441207b2f (diff) |
Fix [#36479] Particle instance Modifier random position snaps objects to 0 position
Most work (tracking bug) done by Anthony Edlin, many thanks!
Great example of why having duplicate code is never a good idea... ;)
Diffstat (limited to 'source/blender/blenlib/intern/rand.c')
-rw-r--r-- | source/blender/blenlib/intern/rand.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c index 743d910e418..c5b58e5a61b 100644 --- a/source/blender/blenlib/intern/rand.c +++ b/source/blender/blenlib/intern/rand.c @@ -175,20 +175,10 @@ float BLI_frand(void) float BLI_hash_frand(unsigned int seed) { - r_uint64 X; - - seed = seed + hash[seed & 255]; - X = (((r_uint64) seed) << 16) | LOWSEED; - seed = (int)(((MULTIPLIER * X + ADDEND) & MASK) >> 17); - - seed = seed + hash[seed & 255]; - X = (((r_uint64) seed) << 16) | LOWSEED; - X = (int)(((MULTIPLIER * X + ADDEND) & MASK) >> 17); - - seed = seed + hash[seed & 255]; - X = (((r_uint64) seed) << 16) | LOWSEED; + RNG rng; - return (int)(((MULTIPLIER * X + ADDEND) & MASK) >> 17); + BLI_rng_srandom(&rng, seed); + return BLI_rng_get_float(&rng); } void BLI_array_randomize(void *data, int elemSize, int numElems, unsigned int seed) |