flat assembler
Message board for the users of flat assembler.
Index
> Tutorials and Examples > PRNG |
Author |
|
revolution 12 May 2021, 15:06
Ali.Z wrote: check for any duplicates For example, if you are doing a lottery draw like pick 6 from 40, then generate a complete list of 40 integers, randomise the order of the list, read off the first 6 values. |
|||
12 May 2021, 15:06 |
|
Ali.Z 12 May 2021, 16:49
thank you, yes it is good idea.
and its simple to modify current code to skip over duplicated numbers instead of aborting the program. and obviously save the list of desired/generated unique numbers, or just let it compute it everytime on the fly. _________________ Asm For Wise Humans |
|||
12 May 2021, 16:49 |
|
bzt 01 Sep 2021, 16:14
Or even better, if CPUID[EAX=1].ECX bit 30 is set (available on Ivy Bridge and later):
Code: rdrand eax Cheers, bzt |
|||
01 Sep 2021, 16:14 |
|
Roman 01 Sep 2021, 16:35
fasm support rdrand and RDSEED ?
Or we need write db $0F, $C7, $F0 ;RDRAND EAX db $48, $0F, $C7, $F8 ;RDSEED RAX PS: RDRand slow 35%, а RDSeed slow 50% then c functions. But gived best result. |
|||
01 Sep 2021, 16:35 |
|
bzt 01 Sep 2021, 17:21
fasm does support RDRAND natively. There's no C function for this, as it is a single instruction (you have to use intrinsics or inline Assembly in C, which means no performance difference between C and Assembly implementations).
Cheers, bzt |
|||
01 Sep 2021, 17:21 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.