| 29 | } |
| 30 | |
| 31 | static int getRandom() |
| 32 | { |
| 33 | auto next = seed; |
| 34 | next *= 1103515245; |
| 35 | next += 12345; |
| 36 | auto result = (unsigned int)(next / 65536) % 2048; |
| 37 | |
| 38 | next *= 1103515245; |
| 39 | next += 12345; |
| 40 | result <<= 10; |
| 41 | result ^= (unsigned int)(next / 65536) % 1024; |
| 42 | |
| 43 | next *= 1103515245; |
| 44 | next += 12345; |
| 45 | result <<= 10; |
| 46 | result ^= (unsigned int)(next / 65536) % 1024; |
| 47 | |
| 48 | seed = next; |
| 49 | |
| 50 | return int(result); |
| 51 | } |
| 52 | |
| 53 | void randomSeed(uint16_t seed) |
| 54 | { |