There is no way cause things to revert to the default value. Unless you
really, really need to have the reproducible sequence, just don't use the
explicit seed at all.
Rick
On Sat, Apr 19, 2014 at 11:21 AM, Staffan Tylen <staffan.ty...@gmail.com>wrote:
> Aaah so that's it! Yes, I have a call to random with a seed in a different
> place of the app. So that seed hangs on for the duration of the program? Is
> there any way to 'drop' it, or do I need to use a different seed in the
> code that I posted on the list using for example a timer value to overcome
> this? Thanks for spotting this.
>
> Staffan
>
>
>
> On Sat, Apr 19, 2014 at 5:07 PM, Rick McGuire <object.r...@gmail.com>wrote:
>
>> 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
>>
>>
>
>
> ------------------------------------------------------------------------------
> 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