From 3cc80610c8a163dcb76faf68996934958fb785e6 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sun, 12 Dec 2021 13:08:26 -0800 Subject: playing with Paul Batchelor's Trikufic tileset https://pbat.ch/wiki/trikuf https://merveilles.town/@akkartik/107432999019092669 --- 517random.mu | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 517random.mu (limited to '517random.mu') 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 +} -- cgit 1.4.1-2-gfad0