[Bf-blender-cvs] [53a9cde038b] blender2.8: Particle: Use local RNG during initialization

Sergey Sharybin noreply at git.blender.org
Tue Jun 12 15:38:35 CEST 2018


Commit: 53a9cde038b52585e98a07548319e0d91a989d2e
Author: Sergey Sharybin
Date:   Tue Jun 12 15:23:38 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB53a9cde038b52585e98a07548319e0d91a989d2e

Particle: Use local RNG during initialization

===================================================================

M	source/blender/blenkernel/intern/particle.c

===================================================================

diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c
index 497694cab90..2bba32ff592 100644
--- a/source/blender/blenkernel/intern/particle.c
+++ b/source/blender/blenkernel/intern/particle.c
@@ -100,13 +100,13 @@ float PSYS_FRAND_BASE[PSYS_FRAND_COUNT];
 
 void psys_init_rng(void)
 {
-	int i;
-	BLI_srandom(5831); /* arbitrary */
-	for (i = 0; i < PSYS_FRAND_COUNT; ++i) {
-		PSYS_FRAND_BASE[i] = BLI_frand();
-		PSYS_FRAND_SEED_OFFSET[i] = (unsigned int)BLI_rand();
-		PSYS_FRAND_SEED_MULTIPLIER[i] = (unsigned int)BLI_rand();
+	RNG *rng = BLI_rng_new_srandom(5831); /* arbitrary */
+	for (int i = 0; i < PSYS_FRAND_COUNT; ++i) {
+		PSYS_FRAND_BASE[i] = BLI_rng_get_float(rng);
+		PSYS_FRAND_SEED_OFFSET[i] = (unsigned int)BLI_rng_get_int(rng);
+		PSYS_FRAND_SEED_MULTIPLIER[i] = (unsigned int)BLI_rng_get_int(rng);
 	}
+	BLI_rng_free(rng);
 }
 
 static void get_child_modifier_parameters(ParticleSettings *part, ParticleThreadContext *ctx,



More information about the Bf-blender-cvs mailing list