Clean up pseudorandom() a bit.
This commit is contained in:
parent
527318bd65
commit
4a2cde56cc
1 changed files with 6 additions and 7 deletions
|
@ -113,15 +113,14 @@ noref int input_sequence;
|
||||||
float
|
float
|
||||||
pseudorandom()
|
pseudorandom()
|
||||||
{
|
{
|
||||||
float a = (float)input_sequence % 5;
|
float seed = (float)input_sequence % 5;
|
||||||
float b = (float)input_sequence % 8;
|
seed += (float)input_sequence % 8;
|
||||||
float c = (float)input_sequence % 4;
|
seed += (float)input_sequence % 4;
|
||||||
float d = (float)input_sequence % 13;
|
seed += (float)input_sequence % 13;
|
||||||
float f = (float)input_sequence % 70;
|
seed += (float)input_sequence % 70;
|
||||||
print(sprintf("random %f\n", (a+b+c+d+f) / 100.0f));
|
|
||||||
|
|
||||||
/* like the engine its random(), never return 0, never return 1 */
|
/* like the engine its random(), never return 0, never return 1 */
|
||||||
return bound(0.01, (a+b+c+d+f) / 100.0f, 0.99f);
|
return bound(0.01, (seed) / 100.0f, 0.99f);
|
||||||
}
|
}
|
||||||
|
|
||||||
__wrap void
|
__wrap void
|
||||||
|
|
Loading…
Reference in a new issue