flat assembler
Message board for the users of flat assembler.
Index
> DOS > Random number generation Goto page Previous 1, 2 |
Author |
|
bitRAKE 13 Dec 2010, 00:41
Code: ; 32-bit maximal length LHCA mov edx,4001h ; bits 0,14 lea ecx,[eax+eax] and edx,eax shr eax,1 xor eax,ecx xor eax,edx ; 64-bit maximal length LHCA mov edx,10100b ; bits 2,4 lea rcx,[rax+rax] and edx,eax shr rax,1 xor rax,rcx xor rax,rdx ; 128-bit maximal length LHCA mov ebx,$10000001 ; bits 0,28 mov rsi,rax mov rdi,rdx and ebx,eax shr rdx,1 rcr rax,1 add rsi,rsi adc rdi,rdi xor rax,rsi xor rdx,rdi xor rax,rbx Last edited by bitRAKE on 13 Dec 2010, 00:50; edited 1 time in total |
|||
13 Dec 2010, 00:41 |
|
revolution 13 Dec 2010, 00:49
What is LHCA? Is it Linear Hybrid Cellular Automata?
|
|||
13 Dec 2010, 00:49 |
|
bitRAKE 13 Dec 2010, 00:50
yeap
|
|||
13 Dec 2010, 00:50 |
|
bitRAKE 13 Dec 2010, 01:01
Code: ; 64-bit maximal length LFSR test byte[rnd],00011011b setpe al shr al,1 rcr qword [rnd],1 |
|||
13 Dec 2010, 01:01 |
|
edfed 13 Dec 2010, 11:31
effectivelly, the curve given by the monitor shows that 0 never appears, and that it is more like INC or DEC instruction, but at least, the distribution is straight
[edit] in fact, the 0 value appears, it was just a bug in plotc. |
|||
13 Dec 2010, 11:31 |
|
bitRAKE 14 Dec 2010, 08:06
bitRAKE wrote: They cannot take zero as input, nor generate zero as output. Otherwise each covers the complete bit range. MWC1038, period 2^33242-1, state bytes 4,152. CMWC4096, period 2^131086-1, state bytes 16,384. The great thing about SFMT is the test harness - there are so many bad implementations of random number generators on the web. It is easy to produce erroneous code without knowing the mathematics behind their creation (the position I'm usually in). On the contrary LHCA's are incredibly simple to understand. [A][B][C] * MWC1038, CMWC4096, and SFMT referenced above are PRNG suggestions of George Marsaglia _________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
14 Dec 2010, 08:06 |
|
Goto page Previous 1, 2 < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.