14 lines
288 B
Python
14 lines
288 B
Python
|
|
def bsd_rand(seed):
|
||
|
|
def rand():
|
||
|
|
nonlocal seed
|
||
|
|
seed = (1103515245*seed + 12345) & 0x7fffffff
|
||
|
|
return seed
|
||
|
|
return rand
|
||
|
|
|
||
|
|
def msvcrt_rand(seed):
|
||
|
|
def rand():
|
||
|
|
nonlocal seed
|
||
|
|
seed = (214013*seed + 2531011) & 0x7fffffff
|
||
|
|
return seed >> 16
|
||
|
|
return rand
|