Sherlock, Ric wrote: > I was scanning my way through the recently updated "A Brief J Reference" > http://www.jsoftware.com/books/pdf/brief.pdf > and found the following in section "25 Randomization and Simulation": > > randomize '' randomize random seed; randomize is defined in numeric.ijs > > Pulling up numeric.ijs : > NB. ========================================================= > NB.*randomize v sets a random value into random link > randomize=: 3 : 0 > ([ 9!:1) >:<.0.8*0 60 60 24 31#.0 0 0 0 _1+|.<.}.6!:0 '' > ) > > So there is a verb in the standard library which does exactly what I > wanted. However given the discussion of verb guids and it being a > cross-platform solution, I wonder if it might be better to redefine > randomize using: > 9!:1 (_2) 3!:4 , guids 1 > > Obviously a downside is that randomize would then have dependencies.
The randomize verb works well enough (it does a hash of the timestamp), but I think Stefano's guid approach is better, not least because it generates more numbers, while randomize generates one number per second. So the randomize library utility should probably be rewritten using guids (when we get the Mac version working). I doubt that guids really return proper random numbers, even though they make good salts, so I do suggest you use roll afterwards in your app. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
