diff options
Diffstat (limited to '517random.mu')
-rw-r--r-- | 517random.mu | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/517random.mu b/517random.mu new file mode 100644 index 00000000..0e907442 --- /dev/null +++ b/517random.mu @@ -0,0 +1,11 @@ +fn next-random prev: int -> _/edi: int { + # https://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use + var a/ecx: int <- copy 0x4b/75 + var c/edx: int <- copy 0x4a/74 + var m/ebx: int <- copy 0x10001 + var next/eax: int <- copy prev + next <- multiply a + next <- add c + next <- remainder next, m + return next +} |