mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 22:31:05 +00:00
Better (-1..1) random numbers.
Now the distribution should be more even as the rng doesn't affect the exponent.
This commit is contained in:
parent
b6d4766201
commit
3193ffd9cc
1 changed files with 4 additions and 2 deletions
|
@ -58,9 +58,11 @@ rnd (mtstate_t *mt)
|
||||||
} uf;
|
} uf;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
uf.u = mtwist_rand (mt) & 0x3fffffff;
|
uf.u = mtwist_rand (mt) & 0x007fffff;
|
||||||
} while (!uf.u);
|
} while (!uf.u);
|
||||||
return uf.f - 1.0;
|
uf.u |= 0x40000000;
|
||||||
|
|
||||||
|
return uf.f - 3.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
Loading…
Reference in a new issue