Skip to content

Instantly share code, notes, and snippets.

View fidergo-stephane-gourichon's full-sized avatar

Stéphane Gourichon fidergo-stephane-gourichon

View GitHub Profile
@raxoft
raxoft / cmwc.asm
Last active August 2, 2022 14:29
Fast quality CMWC random number generator for Z80 I have created to weed out the crap RNGs out there. 32+10 bytes, 146..149 T cycles, period 253*2^59, which is more than 2^66 or 10^20.
; 8-bit Complementary-Multiply-With-Carry (CMWC) random number generator.
; Created by Patrik Rak in 2012, and revised in 2014/2015,
; with optimization contribution from Einar Saukas and Alan Albrecht.
; See http://www.worldofspectrum.org/forums/showthread.php?t=39632
org 40000
call rnd ; BASIC driver
ld c,a
ld b,0