Jafar,
Even the small perturbation changes the sequence produced with ?n. If you run
the program twice very quickly you can see the same sequence. Actually,
&random itself seems to be clock based and grows second to second.
It's a gut reaction, whenever I see any clustering/lack of spread in random
numbers I find it disturbing. I'm used to looking for crypto strength
randomness and have to remind myself that PRNGs of this type work for
simulation/modeling/games but they are limited.
David
>________________________________
> From: Jafar Al-Gharaibeh <[email protected]>
>To: David Gamey <[email protected]>
>Cc: UniconGroup <[email protected]>
>Sent: Thursday, February 2, 2012 7:27:26 PM
>Subject: Re: [Unicon-group] &random behaviour and documentation.
>
>
>Hi David,
>
> I believe &random is the seed and not to be confused with the random
>sequence you would get if you use the "?" operator. &random probably gets its
>initial value using the system clock with some simple math. That is why you
>have numbers (seeds) that are all clustered together since probably you ran
>the program several times around the same clock. If you want the same sequence
>to be repeated, set &random at program start up to a specific value, zero for
>example, but if you want random numbers you can do something like
>
> ?x # where x is 10^6 for example to get numbers in the range of [0 :
>10^6-1 ]
> # (have to double check if I got the boundaries right)
>
>In any case, the Unicon book seems to be inconsistent about whether the value
>of &random is "randomly" set at start up or not. I believe it is.
>
>Jafar
>
>
>
>
>On Thu, Feb 2, 2012 at 3:59 PM, David Gamey <[email protected]> wrote:
>
>Hi Folks,
>>
>>
>>I know the built-in PRNG is a bit quirky and as I understand it Unicon
>>departed from Icon by randomizing it initially (although UB3/Sesrit
>>contradicts this).
>>
>>
>>
>>If I run this several times on Win7/x64 UniconV12:
>>
>>
>>procedure main();write("&random=",&random);end
>>
>>
>>
>>I get only minor variations:
>>
>>
>>&random=20122651
>>&random=20122851
>>&random=20123251
>>&random=20123351
>>&random=20123451
>>&random=20122961
>>&random=20123161
>>&random=20123261
>>&random=20123361
>>&random=20123461
>>
>>
>>Does anyone have any idea what is supposed to happen?
>>
>>
>>This doesn't help much for testing (fixed &random) or for simulation (random
>>&random)
>>
>>
>>David
>>
>>
>>
>>
>>
>>------------------------------------------------------------------------------
>>Keep Your Developer Skills Current with LearnDevNow!
>>The most comprehensive online learning library for Microsoft developers
>>is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>>Metro Style Apps, more. Free future releases when you subscribe now!
>>http://p.sf.net/sfu/learndevnow-d2d
>>_______________________________________________
>>Unicon-group mailing list
>>[email protected]
>>https://lists.sourceforge.net/lists/listinfo/unicon-group
>>
>>
>
>
>--
>"Let there be no compulsion in religion: Truth stands out clear from error"
>[The Holy Qur'an 2:256]
>
>"Injustice anywhere is a threat to justice everywhere" Dr. King
>
>------------------------------------------------------------------------------
>Try before you buy = See our experts in action!
>The most comprehensive online learning library for Microsoft developers
>is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
>Metro Style Apps, more. Free future releases when you subscribe now!
>http://p.sf.net/sfu/learndevnow-dev2
>_______________________________________________
>Unicon-group mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/unicon-group
>
>
>------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group