The MASM Forum

64 bit assembler => 64 bit assembler. Conceptual Issues => Topic started by: Gunther on September 30, 2013, 08:41:42 AM

Title: Quick and dirty RDRAND test
Post by: Gunther on September 30, 2013, 08:41:42 AM
Attached is the archive RAND1.ZIP; it contains the sources and the running EXE for a first RDRAND test application. It generates 1 billion random numbers and checks for generating errors. Here is the output of the program:

Generating 1 billion  random numbers with RDRAND
That'll take a little while ...

Number of generated random numbers = 1000000000
Generating errors                  = 0


Gunther
Title: Re: Quick and dirty RDRAND test
Post by: KeepingRealBusy on September 30, 2013, 09:09:06 AM
Gunther,

I have read the links to the various discussions about rdrand, and checked my PDF's for my AMD laptop. I see no reference to RDRAND in any of the PDF's. Is this not supported except for INTEL chips?

Or is it just not mentioned for security reasons?

Dave.
Title: Re: Quick and dirty RDRAND test
Post by: habran on September 30, 2013, 09:40:21 AM
It would be great to include a speed testing  ;)
Title: Re: Quick and dirty RDRAND test
Post by: Paulo on September 30, 2013, 06:16:15 PM
@KeepingRealBusy

As far as I know, AMD does not support RdRAND.
You can check this by first using CPUID then checking to see if bit 30 of ecx is set.
(as Gunther does in his code).
If not set means your cpu does not support RdRAND.

Another related instruction is RdSEED which can be used to seed a PRNG of arbitary width.
Title: Re: Quick and dirty RDRAND test
Post by: dedndave on September 30, 2013, 07:54:39 PM
RdRand is only available on intel ivy bridge processors, so far

from the wiki page...
QuoteA new random number generator and the RdRand instruction, codenamed Bull Mountain.

it's as though it was named so you could make your own punchline   :lol:
Title: Re: Quick and dirty RDRAND test
Post by: Paulo on September 30, 2013, 08:26:03 PM
Quote from: dedndave

it's as though it was named so you could make your own punchline   :lol:

A few come to mind.   :biggrin:
Title: Re: Quick and dirty RDRAND test
Post by: dedndave on September 30, 2013, 08:49:31 PM
an interesting article...

http://spectrum.ieee.org/computing/hardware/behind-intels-new-randomnumber-generator (http://spectrum.ieee.org/computing/hardware/behind-intels-new-randomnumber-generator)

it's a shame the cloud of conspiracy might impair the future of technology
Title: Re: Quick and dirty RDRAND test
Post by: Paulo on September 30, 2013, 09:05:50 PM
Very nice article dedndave.
Now if I can only find a lava lamp with USB interface. :biggrin:
Title: Re: Quick and dirty RDRAND test
Post by: Gunther on September 30, 2013, 09:12:25 PM
Dave,

Quote from: KeepingRealBusy on September 30, 2013, 09:09:06 AM
I have read the links to the various discussions about rdrand, and checked my PDF's for my AMD laptop. I see no reference to RDRAND in any of the PDF's. Is this not supported except for INTEL chips?

Up to now only for Intel Ivy Bridge processors.

Habran,

Quote from: habran on September 30, 2013, 09:40:21 AM
It would be great to include a speed testing  ;)

it's only quick and dirty. At the moment I'm writing a Monte Carlo simulation. Please have patience.

Gunther
Title: Re: Quick and dirty RDRAND test
Post by: habran on September 30, 2013, 10:53:23 PM
QuoteAt the moment I'm writing a Monte Carlo simulation :icon_eek:
Please explain???
Title: Re: Quick and dirty RDRAND test
Post by: Gunther on September 30, 2013, 11:07:05 PM
Habran,

Quote from: habran on September 30, 2013, 10:53:23 PM
QuoteAt the moment I'm writing a Monte Carlo simulation :icon_eek:
Please explain???

you're impatient. I'll provide not only the source (C + Assembly Language), but also the necessary mathematical background information.

Gunther
Title: Re: Quick and dirty RDRAND test
Post by: habran on October 01, 2013, 05:49:00 AM
Sagenhaft  8)