| 24 | } |
| 25 | |
| 26 | s32 random_next() |
| 27 | { |
| 28 | // Shift the seed by 1 (divide by two), and |
| 29 | // xor the top 8 bits with b10100011 (163) if the starting seed is odd. |
| 30 | // This has the effect of increasing the size of the seed if it gets too small due to the shifts, and increasing "randomness" |
| 31 | if (s_seed & 1) |
| 32 | { |
| 33 | s_seed = (s_seed >> 1) ^ 0xa3000000; |
| 34 | } |
| 35 | else |
| 36 | { |
| 37 | s_seed = (s_seed >> 1); |
| 38 | } |
| 39 | return s32(s_seed); |
| 40 | } |
| 41 | |
| 42 | // Generate a random value as: |
| 43 | // 1) random_next() or |
no outgoing calls
no test coverage detected