* random seed
@ 2012-11-14 18:55 Peter Rolf
2012-11-14 19:20 ` Hans Hagen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Rolf @ 2012-11-14 18:55 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi,
in one of my documents I use a specific random seed to create a fixed
random based graphic (size, color, position). This works fine under
Windows (where I 'found' the seed value), but I get a complete different
result on my Debian system.
Is there a way to get identical results on different OS? Or is the
random number generator OS specific? Just wondering...
Peter
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: random seed
2012-11-14 18:55 random seed Peter Rolf
@ 2012-11-14 19:20 ` Hans Hagen
2012-11-14 20:15 ` Peter Rolf
0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2012-11-14 19:20 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 11/14/2012 7:55 PM, Peter Rolf wrote:
> Hi,
>
> in one of my documents I use a specific random seed to create a fixed
> random based graphic (size, color, position). This works fine under
> Windows (where I 'found' the seed value), but I get a complete different
> result on my Debian system.
>
> Is there a way to get identical results on different OS? Or is the
> random number generator OS specific? Just wondering...
yes and it cannot be trusted either (some underlying os code is used); i
also found out that you need to call a couple of random's in a row first
to get at least not the same ones in the beginning
in contetx I've now settled on:
math.initialseed =
tonumber(string.sub(string.reverse(tostring(ceil(socket and
socket.gettime()*10000 or time()))),1,6))
Hans
-----------------------------------------------------------------
Hans Hagen | PRAGMA ADE
Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
| www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: random seed
2012-11-14 19:20 ` Hans Hagen
@ 2012-11-14 20:15 ` Peter Rolf
0 siblings, 0 replies; 3+ messages in thread
From: Peter Rolf @ 2012-11-14 20:15 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
Am 14.11.2012 20:20, schrieb Hans Hagen:
> On 11/14/2012 7:55 PM, Peter Rolf wrote:
>> Hi,
>>
>> in one of my documents I use a specific random seed to create a fixed
>> random based graphic (size, color, position). This works fine under
>> Windows (where I 'found' the seed value), but I get a complete different
>> result on my Debian system.
>>
>> Is there a way to get identical results on different OS? Or is the
>> random number generator OS specific? Just wondering...
>
> yes and it cannot be trusted either (some underlying os code is used); i
> also found out that you need to call a couple of random's in a row first
> to get at least not the same ones in the beginning
>
> in contetx I've now settled on:
>
> math.initialseed =
> tonumber(string.sub(string.reverse(tostring(ceil(socket and
> socket.gettime()*10000 or time()))),1,6))
>
>
Thanks for the info. The formula looks like an incantation for the god
of random numbers ;-)
I already migrated the tex code to lua, so that I can do some post
processing on the collected random based data. To get identical results,
I only have to save the final data set then.
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage : http://www.pragma-ade.nl / http://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-11-14 20:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-14 18:55 random seed Peter Rolf
2012-11-14 19:20 ` Hans Hagen
2012-11-14 20:15 ` Peter Rolf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).