# | Line 25 | Line 25 | irandom( /* better than using random() % modulus */ | |
---|---|---|
25 | long modulus | |
26 | ) | |
27 | { | |
28 | < | static const int isize = sizeof(int); |
29 | < | static const int lsize = sizeof(long); |
30 | < | static const int llsize = sizeof(long long); |
31 | < | |
32 | < | if ((lsize == 8) | (isize == 8)) |
28 | > | if (sizeof(long) >= 8) |
29 | return((random()*modulus)>>31); | |
30 | ||
31 | < | if (llsize == 8) |
31 | > | if (sizeof(long long) >= 8) |
32 | return((random()*(long long)modulus)>>31); | |
33 | ||
34 | < | return(random() % modulus); |
34 | > | return(frandom()*modulus); |
35 | } | |
36 | ||
37 | int |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |