News:

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

random seed generator.

Started by hutch--, October 27, 2010, 03:53:20 AM

Previous topic - Next topic

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Tedd

I made a random seed generator too :bg


No snowflake in an avalanche feels responsible.

Vortex

Here is my version.  :P

hutch--

 :bg

There is genuine genius here.  :P
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

those guys are here to make you look good, Hutch   :P
(p.s. it seems to be working)

Gunther

Hutch,

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

Gunther
Forgive your enemies, but never forget their names.

hutch--

 :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
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Gunther

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
Forgive your enemies, but never forget their names.

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

i dunno why you guys are down on poor Kylie
she's kinda hot, if you ask me

hutch--

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.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Gunther

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
Forgive your enemies, but never forget their names.

dedndave

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

Gunther

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
Forgive your enemies, but never forget their names.