Ensure that pseudo random numbers are always >0

This commit is contained in:
Yamagi Burmeister 2012-06-02 12:11:14 +02:00
parent 40ff7a6b09
commit fc2d67bac1

View file

@ -40,12 +40,17 @@ B64MWC(void)
/*
* Generate a pseudorandom
* signed integer.
* integer >0.
*/
int
randk(void)
{
return (int)KISS;
int r;
r = (int)KISS;
r = (r < 0) ? (r * -1) : r;
return r;
}
/*