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.


> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Sherlock, Ric
> Sent: Friday, 15 June 2007 11:22
> To: Programming forum
> Subject: RE: [Jprogramming] generating random seed
> 
> > > > >The problem is that because each page request starts a new
> console session, the random > > > >seed is often the same 
> (7^5), and each registering user gets the same "salt" 
> > >    ...this is cross platform. For example:
> > >    load'guid'
> > >    9!:1 (_2) 3!:4 , guids 1    NB. set random seed
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to