19 lines
440 B
Python
19 lines
440 B
Python
|
#!/usr/bin/env python3
|
||
|
|
||
|
# World's worst random number generator
|
||
|
def rand_step(inp):
|
||
|
polynomial = 0x04C11DB7
|
||
|
output = inp + 1
|
||
|
for i in range(32):
|
||
|
if output & 0x80000000:
|
||
|
output ^= polynomial
|
||
|
output = (output << 1) & 0xffffffff
|
||
|
return output & 0xffffffff
|
||
|
|
||
|
def main():
|
||
|
init = 0
|
||
|
for i in range(20):
|
||
|
init = rand_step(init)
|
||
|
print("{:08x}".format(init))
|
||
|
|
||
|
main()
|