mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-23 04:42:32 +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;
|
||||
|
||||
do {
|
||||
uf.u = mtwist_rand (mt) & 0x3fffffff;
|
||||
uf.u = mtwist_rand (mt) & 0x007fffff;
|
||||
} while (!uf.u);
|
||||
return uf.f - 1.0;
|
||||
uf.u |= 0x40000000;
|
||||
|
||||
return uf.f - 3.0;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
Loading…
Reference in a new issue