Do you ever specify a seed value with a prior random call? That would
force a repeatable sequence. Other than that, I'd need a program that
reproduces the problem to figure this out.
Rick
On Sat, Apr 19, 2014 at 10:38 AM, Staffan Tylen <staffan.ty...@gmail.com>wrote:
> I have the following code in an application (where pfxlen already has been
> set to 4):
>
> pfx = ""
> do pfxlen
> pfx ||= xrange("00"x,"7F"x)~substr(random(1,127),1)
> end
>
> But when I run the application, pfx is always generated with the same
> value: BNB" or '424E4222'x - but it should be random!
>
> To debug this I lifted this code snippet to a test program, adding
> pfxlen=4 as the first instruction, and then pfx gets different values each
> time, as expected.
>
> When I do a 'trace i' I can see that random(...) is returning the same
> value sequence each time when running the code in the application: 67, 79,
> 67, 35. When I run the test program it always returns different values.
>
> OK, so I change the program to this:
>
> pfx = ""
> do pfxlen
> rand = random(1,127)
> pfx ||= xrange("00"x,"7F"x)~substr(rand,1)
> end
>
> No change, the same values are returned. So then I try this:
>
> pfx = ""
> do pfxlen
> say random(1,127)
> pfx ||= xrange("00"x,"7F"x)~substr(random(1,127),1)
> end
>
> Now pfx gets the value N";* ('4E223B2A'x) but also now it gets the same
> value EVERY time.
>
> I can only conclude that there must be a bug in the random() function that
> seems to introduce a seed on its own under certain circumstances, is that
> possible? I cannot explain this behaviour in any other way.
>
> Staffan
>
>
>
> ------------------------------------------------------------------------------
> Learn Graph Databases - Download FREE O'Reilly Book
> "Graph Databases" is the definitive new guide to graph databases and their
> applications. Written by three acclaimed leaders in the field,
> this first edition is now available. Download your free book today!
> http://p.sf.net/sfu/NeoTech
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
>
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users