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

Reply via email to