Changes

Jump to: navigation, search

Programming:Random Number Generator

337 bytes added, 07:03, 18 November 2015
db &70,&27,&F7,&1F,&BE,&12,&B6,&50,&BC,&4D,&28,&C8,&84,&30,&A5,&4C
db &AB,&E9,&8E,&E8,&7E,&C4,&89,&8B,&0B,&24,&85,&3E,&38,&04,&D2,&90
</pre>
 
=== 8-bit random number generator using Refresh Register (R) ===
 
Code courtesy from Singaja, this seems to produce a more random effect.
 
'''Input:''' ''none''
 
'''Output:''' seed = ''a pseudo random number, period 256''
 
<pre>
.rnd
ld a,r
ld b,a
ld a,(seed)
xor b
add a
xor b
ld (seed),a
ret
.seed db 0
</pre>
423
edits