Re: Random Number Generation
Posted in 1996
Joseph Kormann — — source: Informix-list mailing list archive (1991-1998)
In article <32A74903.5BE@netone.com>, Shawn Sheridan <ssheridan@netone.com> wrote: >Hello, > >Does anyone know of a SQL function/routine to generate random numbers, >or of a basic RNG algorithm that could be coded in SQL. Just want to >generate a random number between 1 and x. > >I am using Illustra Server and would like to create this function using >SQL, if not I will use C. > >thanks, Shawn. What we did in a pinch was use a function of the time at runtime. Something like (minute / hour * second) to give us a pseudo-random number. Depending on your needs, you could use that. And for more randomness, you could also throw in rowid and possibly some part of the date. Enjoy. -Joseph