Notes on seeding 'random/seed (long)
[1/3] from: reboler::programmer::net at: 20-Mar-2004 22:08
Here are some things I found out will working on 'random/secure and 'random/seed that
may be of help to others.
I wanted to completely utilize the time provided by 'now/precise as the seed for 'random/seed.
(for some cryptography related scripts)
(the following messages are from the escribe archives and console output is from view
1.2.5.3.1
From an earlier question on using 'random Joel Neely wrote:
Date: Thu, 22 Aug 2002 15:09:45
"The documentation should state what types of values are acceptable
as seeds. I believe that you need to restrict yourself to date!,
time!, or integer! values for legitimate seeds."
And Frank Sievertsen wrote:
[REBOL] Re: True Random
Date: Mon, 20 Aug 2001 00:09:35
Try this:
random/seed checksum form now/precise
CU,
Frank
With Petr Krenzelok adding:
Date: Mon, 20 Aug 2001 00:32:38
you can even use checksum/secure ....
-pekr-
But please observe the following...
It appears that 'random/seed seeded with time ('now/precise) only seeds to the second!
...
randomize-series: func [series][
random/seed now/precise
random/secure series
]
>> loop 10 [print [now/precise randomize-series "12345"]]
15-Jan-2004/12:20:06.968-5:00 14532
15-Jan-2004/12:20:06.968-5:00 14532
15-Jan-2004/12:20:06.968-5:00 14532
15-Jan-2004/12:20:06.984-5:00 14532
15-Jan-2004/12:20:06.984-5:00 14532
15-Jan-2004/12:20:07-5:00 13524
15-Jan-2004/12:20:07-5:00 13524
15-Jan-2004/12:20:07.015-5:00 13524
15-Jan-2004/12:20:07.015-5:00 13524
15-Jan-2004/12:20:07.015-5:00 13524
.... as you see the randomized string only changes with the second.
Changing the time to an integer won't work ...
>> loop 10 [print [now/precise to-integer now/time/precise]]
15-Jan-2004/12:13:32.953-5:00 44012
15-Jan-2004/12:13:32.968-5:00 44012
15-Jan-2004/12:13:32.968-5:00 44012
15-Jan-2004/12:13:32.968-5:00 44012
15-Jan-2004/12:13:32.984-5:00 44012
15-Jan-2004/12:13:32.984-5:00 44012
15-Jan-2004/12:13:33-5:00 44013
15-Jan-2004/12:13:33-5:00 44013
15-Jan-2004/12:13:33-5:00 44013
15-Jan-2004/12:13:33.015-5:00 44013
.... as you can see that the integer changes only with the second.
Also, note that I only changed the time (not the date) to integer, because ...
>> to-integer now/precise
** Script Error: Invalid argument: 15-Jan-2004/12:30:15.734-5:00
** Where: to-integer
** Near: to integer! :value
.... thus not using the date portion in the potential seed.
You cannot use checksum/secure on the time because ...
>> random/seed checksum/secure form now/precise
== {=EEen|^E=80^A=94d=A6=97=C2=EA/=CC^K^G=AC=D1=FD}
.... and ...
>> seed: checksum/secure form now/precise
== #{70C9F0D1D65FD88B6093DF38FD972ABCA56724B3}
>> random/seed seed
== "=8B`$=97p*=C9=DF=BCg=D8=B3_=D6=A5=F08=FD=93=D1"
>> random/seed seed
== "g=8B_=F0=93=DF=C9`=BCp=FD=D1=D6=A5*$8=97=B3=D8"
>> random/seed seed
== "=A5`=BC=D1_=97p$=D8=F0=8B=FD=D6=C98*=93=B3=DFg"
.... returns a value! Thus the "seed" given above is scrambled , but not passed to random/seed
as a seed.
If "checksum/secure form now/precise" was providing a legitimate seed then the follwing
sequences would be identical ...
>> seed: checksum/secure form now/precise
== #{70C9F0D1D65FD88B6093DF38FD972ABCA56724B3}
>> random/seed seed
== "=93*g`=D1=8B=A5=BC=F0=B3=D8$=C98=D6_=97p=DF=FD"
>> loop 5 [print random/secure "12345"]
53142
31254
32514
25143
32145
>> random/seed seed
== "*=FDg`=D6=D1=B3=DFp=C9=97=93$=A5=D8_8=BC=F0=8B"
>> loop 5 [print random/secure "12345"]
32415
13524
15432
45231
43251
... but they are not the same.
So, to use _all_ of the information provided by 'now/precise (all of 15-Jan-2004/12:34:16.437-5:00)
as a seed to 'random/seed you must
random/seed to-integer checksum/secure form now/precise
Now we see all the behavior we expect ...
>> seed: to-integer checksum/secure form now/precise
== 1264002547
>> random/seed seed
>> loop 5 [print random/secure "12345"]
45213
41325
45321
35124
14523
>> random/seed seed
>> loop 5 [print random/secure "12345"]
45213
41325
45321
35124
14523
Notice that there is nothing returned when providing the seed and that the two sequences
are identical.
Other Observations:
'random/seed will take a date ...
>> seed: now/date
== 16-Jan-2004
>> random/seed seed
>>
... because nothing is returned.
A 'binary is not a legitimate seed ...
>> seed: to-binary 100
== #{313030}
>> random/seed seed
== "010"
.... because a value is returned.
A 'time is a legitimate seed ...
>> seed: now/time
== 22:11:03
>> random/seed seed
>>
.... but remember that it is good only to the second!
So, you need to do two tests to determine if a seed is legitimate:
1) Nothing returned from 'random/seed your-seed
2) Identical random sequences produced when reseeding from the same seed.
To conclude: apparently only dates, times, and integers are legitimate seeds,
and one way to use all of a 'now (including both date and sub-second precision) is to
random/seed to-integer checksum/secure form now/precise
Here's a handy function to reseed to sub-second precision ...
randomize: func [
{Reseed the random number generator using 'now/precise, or enter a date! time! integer!
argument.}
seed [any-type!]
][
random/seed either value? 'seed [seed][to-integer checksum/secure form now/precise]
]
As a bonus (as if this wasn't long enough already!) I have included my gleanings from
the archives about 'random in the following binary!. Just decompress.
probe decompress useful-stuff-on-random: 64#{
eJztW2l720aS/rz4FW14Ziw5vADecGxHhx0p8ZHITjyJHiUBiSaJCASQBiCKzmZ+
+75V3QBByfIRj3cnz7OyqQPdXX3U9VZ14fTk0f7zJ2fiRHrixI+DZCniYjmRKhOz
RImnSZxLceCrKLGsxypZeuKrREbimZTRWuxchHIlknwhlVjKLPPnMhOTtcgXYSb8
Il8kaldYh34O4i/8vCGcjtgr5sLtdFzRGXndsdcbCMuyjmOM8XORpaEK0Q8EpfDx
yVeJmBXxNA+TOBN5IqbJMi2wpG+OxUXoW7y+Jq8PK8CEQdYQSSxFkYXxXJzsPTt8
/lRgX6AvzUq5ydJN7RePDr47ecR7lb8V4YUfyTgXaaHSJJNZy7IEvpbTNPR4HeKU
H9BXmmfiNMT0c6lunVWP21Ey9SNxKdYijLMwkNxythmnn3qiUz2JkiTV5KpH9HWJ
Pq0OfTnirlCaOQ4/6Gx1XL9vx3Amdi7R5XJXfCZ21vhtvSs+vy+cVoe2otelf6KD
s9nU5rdUYcviSt82r/6u6F3plobiyhMlf03CWJzadjm2Sb3ulssVdpoubT3dWXn4
2X/K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wDumpHgZ+2aYs/
g2JrkS8jcEPOGbh7iP30ovSabCtDp/JlnSt3S/qVoPKwbL1Y+obAeSFh8Bqc3trG
tC9VUV6xlwL7GDOeixeU2lU5MeCDa8/dqtjCoRuRztjrfprc/qbYR2zecYSpL4+G
3xLZuj2zDr5rWLxD650H8Y2ETfhayfg1uHj+0cfQdb3u6NMor3WNZwa5AwtvzuiB
eN9TemBZJToExZiD0Kvi1mJn2Ezlubp652v0iF/VIbCmb0bNqR4lEVXpfa2I6Afn
FEelPXTojW1ETN3up4nXYz0fzdYZNfSMgAZUZ+94Tn/vqfiM6g8a4mChsNYqUtqL
6J25rwF2tqMnvowhxKiKmOEOvdNACRoNOag+jhA23+5o/Car+0xK8pVQEbRiyhZE
bPkMMx5S+lPQC6nlNQNf+ADJwmxoYFMxQwYPxeNEgU51bxxwsoGwZs4X3JT953wC
EP7MJzDsR3OAw3yxpAnoxUsdD+jrcwoB+H4z1PCNElJ8J1R7b/0Bvfeh4eJ9fuVu
BxhpSq9RyMBUIP2daiC+py67+swwFcdoRpwIpOqGq6RqtHi8uLshRRk4U+Vi5vlM
OLu7tTcQWJo5R/HiaM8hwMSOIaebO+ykhIYtccxhCW0VevHk4Et2PlQ8eoEQMhPs
4pK58gGwpwxFcfoJjpP8UgQ86SsqMygZSdiSXkdgInShq1FnmWnLEqEveTnlycfL
N/HVDXrpoElRMf1UhRN6a8XcqxM8qWuateA/vlBUN0ZeSHfB1/8AchYdfnNBAAA}
--
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm
[2/3] from: moliad:aei:ca at: 20-Mar-2004 22:37
thanks for this thesis on the randomizing of rebol Alan!
another tidbit of information that wasn't obvious to realize!
-MAx
----- Original Message -----
From: "alan parman" <[reboler--programmer--net]>
To: <[rebol-list--rebol--com]>
Sent: Saturday, March 20, 2004 10:08 PM
Subject: [REBOL] Notes on seeding 'random/seed (long)
> Here are some things I found out will working on 'random/secure and
'random/seed that may be of help to others.
> I wanted to completely utilize the time provided by 'now/precise as the seed
for 'random/seed.
> (for some cryptography related scripts)
>
> (the following messages are from the escribe archives and console output is
from view 1.2.5.3.1
> >From an earlier question on using 'random Joel Neely wrote:
> Date: Thu, 22 Aug 2002 15:09:45
<<quoted lines omitted: 14>>
> But please observe the following...
> It appears that 'random/seed seeded with time ('now/precise) only seeds to the
second! ...
> randomize-series: func [series][
> random/seed now/precise
<<quoted lines omitted: 44>>
> == "=A5`=BC=D1_-p$=D8=F0<=FD=D6=C98*"=B3=DFg"
> ... returns a value! Thus the "seed" given above is scrambled , but not passed
to random/seed as a seed.
> If "checksum/secure form now/precise" was providing a legitimate seed then the
follwing sequences would be identical ...
> >> seed: checksum/secure form now/precise
> == #{70C9F0D1D65FD88B6093DF38FD972ABCA56724B3}
<<quoted lines omitted: 16>>
> .. but they are not the same.
> So, to use _all_ of the information provided by 'now/precise (all of
15-Jan-2004/12:34:16.437-5:00) as a seed to 'random/seed you must
> random/seed to-integer checksum/secure form now/precise
> Now we see all the behavior we expect ...
<<quoted lines omitted: 15>>
> 14523
> Notice that there is nothing returned when providing the seed and that the two
sequences are identical.
> Other Observations:
> 'random/seed will take a date ...
<<quoted lines omitted: 20>>
> To conclude: apparently only dates, times, and integers are legitimate seeds,
> and one way to use all of a 'now (including both date and sub-second
precision) is to
> random/seed to-integer checksum/secure form now/precise
>
> Here's a handy function to reseed to sub-second precision ...
>
> randomize: func [
> {Reseed the random number generator using 'now/precise, or enter a date!
time! integer! argument.}
> seed [any-type!]
> ][
> random/seed either value? 'seed [seed][to-integer checksum/secure form
now/precise]
> ]
>
> As a bonus (as if this wasn't long enough already!) I have included my
gleanings from the archives about 'random in the following binary!. Just
decompress.
[3/3] from: lmecir:mbox:vol:cz at: 23-Mar-2004 9:22
Hi all,
I would like to remind you, that there are more reliable methods of
producing random numbers than using a pseudo-random generator function.
You can e.g. use Andrew's function to access www.random.org
I plan to post my version (usable as the Random function replacement) to
www.compkarori.com/vanilla/display
-L
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted