diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-12-12 13:08:26 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-12-12 13:08:26 -0800 |
commit | 3cc80610c8a163dcb76faf68996934958fb785e6 (patch) | |
tree | 418643dc687048e10609ac9d5a070b69e4266d2c /517random.mu | |
parent | d46441e08249317ee745155ef1a050e66f6def5e (diff) | |
download | mu-3cc80610c8a163dcb76faf68996934958fb785e6.tar.gz |
playing with Paul Batchelor's Trikufic tileset
https://pbat.ch/wiki/trikuf https://merveilles.town/@akkartik/107432999019092669
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 +} |