Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2014-08-10 18:58:22 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2014-08-10 18:58:22 +0400
commitf838e3632d6cdf5fcc11f4c3ed044afeafa6e23f (patch)
tree21dab2f7fee401a3212a622ed952b2decd737b1d /source/blender/blenlib/intern/rand.c
parent002cb94cc68f150344f8ee213c9b02c0b47c3f65 (diff)
parent3cd2c6145ae12956757141a1ea1f58f5eddf0db1 (diff)
Merge branch 'master' into soc-2014-shapekey
Conflicts: source/blender/editors/object/object_shapekey.c
Diffstat (limited to 'source/blender/blenlib/intern/rand.c')
-rw-r--r--source/blender/blenlib/intern/rand.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/rand.c b/source/blender/blenlib/intern/rand.c
index 410f98897ce..3dff0b31091 100644
--- a/source/blender/blenlib/intern/rand.c
+++ b/source/blender/blenlib/intern/rand.c
@@ -95,15 +95,20 @@ void BLI_rng_srandom(RNG *rng, unsigned int seed)
BLI_rng_seed(rng, seed + hash[seed & 255]);
}
-int BLI_rng_get_int(RNG *rng)
+BLI_INLINE void rng_step(RNG *rng)
{
rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK;
+}
+
+int BLI_rng_get_int(RNG *rng)
+{
+ rng_step(rng);
return (int) (rng->X >> 17);
}
unsigned int BLI_rng_get_uint(RNG *rng)
{
- rng->X = (MULTIPLIER * rng->X + ADDEND) & MASK;
+ rng_step(rng);
return (unsigned int) (rng->X >> 17);
}
@@ -167,10 +172,9 @@ void BLI_rng_shuffle_array(RNG *rng, void *data, unsigned int elem_size_i, unsig
void BLI_rng_skip(RNG *rng, int n)
{
- int i;
-
- for (i = 0; i < n; i++)
- BLI_rng_get_int(rng);
+ while (n--) {
+ rng_step(rng);
+ }
}
/***/