The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
June 04, 2023, 10:08:44 AM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  General Forums
| |-+  The Laboratory (Moderator: Mark_Larson)
| | |-+  random seed generator.
« previous next »
Pages: [1] Print
Author Topic: random seed generator.  (Read 11969 times)
hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


random seed generator.
« 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.

* randseed2.zip (46.36 KB - downloaded 325 times.)
Logged

Regards,



Download site for MASM32
http://www.masm32.com
Tedd
Procrastinator Extraordinaire
Member
*****
Posts: 2210


Reality Bytes


Re: random seed generator.
« Reply #1 on: October 28, 2010, 11:59:32 AM »

I made a random seed generator too BigGrin



* seedy.zip (1.3 KB - downloaded 312 times.)
Logged

No snowflake in an avalanche feels responsible.
Vortex
Raider of the lost code
Member
*****
Gender: Male
Posts: 3460



Re: random seed generator.
« Reply #2 on: October 28, 2010, 12:18:27 PM »

Here is my version.  Tongue

* BugIcon.zip (2.3 KB - downloaded 298 times.)
Logged

hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: random seed generator.
« Reply #3 on: October 28, 2010, 02:58:08 PM »

 BigGrin

There is genuine genius here.  Tongue
Logged

Regards,



Download site for MASM32
http://www.masm32.com
dedndave
Member
*****
Posts: 12523


Re: random seed generator.
« Reply #4 on: October 28, 2010, 04:23:34 PM »

those guys are here to make you look good, Hutch   Tongue
(p.s. it seems to be working)
Logged
Gunther
Member
*****
Gender: Male
Posts: 184


Assembly Language Dinosaur


Re: random seed generator.
« Reply #5 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
Logged

Forgive your enemies, but never forget their names.
hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: random seed generator.
« Reply #6 on: October 28, 2010, 10:36:00 PM »

 BigGrin

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.  Tongue
Logged

Regards,



Download site for MASM32
http://www.masm32.com
Gunther
Member
*****
Gender: Male
Posts: 184


Assembly Language Dinosaur


Re: random seed generator.
« Reply #7 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 PM
load Kylie into memory

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

Gunther
Logged

Forgive your enemies, but never forget their names.
hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: random seed generator.
« Reply #8 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.

* rpg.zip (47.99 KB - downloaded 315 times.)
Logged

Regards,



Download site for MASM32
http://www.masm32.com
dedndave
Member
*****
Posts: 12523


Re: random seed generator.
« Reply #9 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
Logged
hutch--
Administrator
Member
*****
Posts: 12013


Mnemonic Driven API Grinder


Re: random seed generator.
« Reply #10 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.
Logged

Regards,



Download site for MASM32
http://www.masm32.com
Gunther
Member
*****
Gender: Male
Posts: 184


Assembly Language Dinosaur


Re: random seed generator.
« Reply #11 on: October 29, 2010, 12:59:05 PM »

Quote from: hutch--, October 29, 2010, at 05:30:50 AM
We are not down on Kylie, its just common knowledge to recognise random noise.

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

Gunther
Logged

Forgive your enemies, but never forget their names.
dedndave
Member
*****
Posts: 12523


Re: random seed generator.
« Reply #12 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   Tongue
Logged
Gunther
Member
*****
Gender: Male
Posts: 184


Assembly Language Dinosaur


Re: random seed generator.
« Reply #13 on: October 29, 2010, 02:20:59 PM »

Quote from: dedndave, October 29, 2010, at 02:06:00 PM
i 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  ThumbsUp.

Gunther
Logged

Forgive your enemies, but never forget their names.
Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!