The MASM Forum Archive 2004 to 2012

General Forums => The Laboratory => Topic started by: hutch-- on October 27, 2010, 03:53:20 AM

Title: random seed generator.
Post by: hutch-- on October 27, 2010, 03:53:20 AM
Unless you have access to a reliable real world random source (microphone in Antarctica, Kylie singing etc ....) you are stuck with trying to pick something useful out of a running computer. This algo takes serialised samples from RDTSC, converts them to string, reverses the string them converts it back to a number. With the two samples it xorres the result and produces a DWORD seed.

The technique of taking two serialised samples from RDTSC relies on no 2 computers running an identical load so the spacing between samples would not be easy to reproduce and will tend to be very different with the post number processing.

The idea of the algo is to allow reasonably fast re-seeding for random number generators so that redundancies that appear with a very long sequence from a random generator don't occur.

To run the test, run the batch file, it runs the exe, writes a 1 million byte random pad then runs ENT to analyse the results.
Title: Re: random seed generator.
Post by: Tedd on October 28, 2010, 11:59:32 AM
I made a random seed generator too :bg


Title: Re: random seed generator.
Post by: Vortex on October 28, 2010, 12:18:27 PM
Here is my version.  :P
Title: Re: random seed generator.
Post by: hutch-- on October 28, 2010, 02:58:08 PM
 :bg

There is genuine genius here.  :P
Title: Re: random seed generator.
Post by: dedndave on October 28, 2010, 04:23:34 PM
those guys are here to make you look good, Hutch   :P
(p.s. it seems to be working)
Title: Re: random seed generator.
Post by: Gunther on October 28, 2010, 09:48:28 PM
Hutch,

what's your suggestion if one has access to Kylie singing? Hard question, I know. :wink

Gunther
Title: Re: random seed generator.
Post by: hutch-- on October 28, 2010, 10:36:00 PM
 :bg

Gunther,

Get an old unreliable RAND() function, load Kylie into memory, work out the pad size you need then use the old RAND() to pick an offset in the Kylie data. Its random noise quality will exceed that of radioactive decay.  :P
Title: Re: random seed generator.
Post by: Gunther on October 28, 2010, 10:48:44 PM
Hutch,

I knew that you could figure out that complicated question.

Quote from: hutch--, October 29, 2010, 11:36:00 PMload Kylie into memory

That's the trick; I can see it now very clear.  :clap:

Gunther
Title: Re: random seed generator.
Post by: hutch-- on October 29, 2010, 12:17:24 AM
Here is a test piece for a random pad generator that uses the random seed algo above. It targets two things, use of the monotonous incrementing of the value that RDTSC accesses to try for a wide range of different random seeds and producing a reasonable random sequence in the output that is not a routine task to reproduce.

Run the EXE and it will create a pad then call ENT to analyse the results.
Title: Re: random seed generator.
Post by: dedndave on October 29, 2010, 04:30:50 AM
i dunno why you guys are down on poor Kylie
she's kinda hot, if you ask me
Title: Re: random seed generator.
Post by: hutch-- on October 29, 2010, 07:44:32 AM
Nah,

We are not down on Kylie, its just common knowledge to recognise random noise.

I knew this guy years ago who used to frequent a pub I went to and if the kids started playing too much crap on the juke box he would put enough money into the juke box to play Kylie 10 times to shut the racket up.
Title: Re: random seed generator.
Post by: Gunther on October 29, 2010, 12:59:05 PM
Quote from: hutch--, October 29, 2010, at 05:30:50 AMWe are not down on Kylie, its just common knowledge to recognise random noise.

Right.  :U Everyone should know that Hutch and me are very hot fans of Kylie since a long time.

Gunther
Title: Re: random seed generator.
Post by: dedndave on October 29, 2010, 01:06:00 PM
well - i don't listen to her music - lol
i have just seen pics of her, is all
she seems to have parts in all the right places   :P
Title: Re: random seed generator.
Post by: Gunther on October 29, 2010, 02:20:59 PM
Quote from: dedndave, October 29, 2010, at 02:06:00 PMi have just seen pics of her

There's a German TV station, which uses Kylie as a stopgap. I'm sure that you could receive the station as an internet stream.

Anyway, Steve's random seed generator is good stuff  :U.

Gunther