[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [59713] trunk/blender/source/blender/ blenlib/intern/rand.c: Fix [#36479] Particle instance Modifier random position snaps objects to 0 position

Bastien Montagne montagne29 at wanadoo.fr
Sun Sep 1 17:31:09 CEST 2013


Revision: 59713
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=59713
Author:   mont29
Date:     2013-09-01 15:31:09 +0000 (Sun, 01 Sep 2013)
Log Message:
-----------
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... ;)

Modified Paths:
--------------
    trunk/blender/source/blender/blenlib/intern/rand.c

Modified: trunk/blender/source/blender/blenlib/intern/rand.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/rand.c	2013-09-01 15:26:47 UTC (rev 59712)
+++ trunk/blender/source/blender/blenlib/intern/rand.c	2013-09-01 15:31:09 UTC (rev 59713)
@@ -175,20 +175,10 @@
 
 float BLI_hash_frand(unsigned int seed)
 {
-	r_uint64 X;
+	RNG rng;
 
-	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;
-
-	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)




More information about the Bf-blender-cvs mailing list