News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

can ASM generate random numbers?

Started by supercoollee, May 12, 2010, 03:58:06 PM

Previous topic - Next topic

supercoollee

i mean, without writing a function by oneself .

clive

It could be a random act of randomness. Those happen a lot as well.

GregL

No.

MASM32 includes a procedure to generate random numbers called nrand.  There is also crt_rand from msvcrt.lib.  nrand would probably be faster if that's a consideration.

MichaelW

With a macro you can get the assembler to generate random numbers at assembly time. There are two examples here:

http://www.masm32.com/board/index.php?topic=9018.0

eschew obfuscation

qWord

not the best, but easy to implement:
rdtsc
and eax,0ffh ; 0...255
FPU in a trice: SmplMath
It's that simple!

Ossa

Or you can use another library... I would recommend Agner Fog's.

If you download the zip file of binary libraries, in that is another zip file with the source code (in asm).

Ossa
Website (very old): ossa.the-wot.co.uk