[Click] Script element

Eddie Kohler kohler at cs.ucla.edu
Mon Sep 7 18:54:12 EDT 2009


I checked in the new behavior that will give you a "truly random" seed 
whenever a router is configured.

E



Eddie Kohler wrote:
> María,
> 
> 1:
> 
> Script(print $(if_test.run 1),
>         print $(if_test.run 2));
> if_test::Script(TYPE PASSIVE,
>         return $(if $(eq $1 1) "GAVE ME ONE" "GAVE ME NOT ONE"))
> 
> When run this will print
> "GAVE ME ONE"
> "GAVE ME NOT ONE"
> 
> 
> 2:
> 
> By default every Click run uses the same random seed, leading to a predictable 
> & deterministic sequence of random values.  This behavior should not be 
> depended on, and in fact I will probably change it today.  In the mean time, 
> try adding a "RandomSeed" element to your configuration.  When given no 
> arguemnts, RandomSeed sets the random seed unpredictably on each run.
> 
> E.g.:
> 
> letni% click -e 'Script(print $(random), stop)'
> 1804289383
> letni% click -e 'Script(print $(random), stop)'
> 1804289383
> letni% click -e 'Script(print $(random), stop)'
> 1804289383
> letni% click -e 'Script(print $(random), stop); RandomSeed'
> 530300448
> letni% click -e 'Script(print $(random), stop); RandomSeed'
> 618331881
> letni% click -e 'Script(print $(random), stop); RandomSeed'
> 1536646481
> 
> 
> Eddie
> 
> 
> María Gómez wrote:
>> Hi all,
>> I have two question about some Script's handler:
>>
>> 1- Can anyone tell me how to use the  if handler? Please, a example.
>>
>> 2-The random handler always return the same number, not refresh.
>>
>> Thanks.
>>
>> Regards.
>>
>> _________________________________________________________________
>> Internet Explorer 8 más sencillo y seguro ¡Descárgatelo gratis!
>> http://events.es.msn.com/noticias/internet-explorer-8/
>> _______________________________________________
>> click mailing list
>> click at amsterdam.lcs.mit.edu
>> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
> 
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click



More information about the click mailing list