Re: Random Number Generation
Posted in 1996
In <58b54j$jt1@arther.castle.net> jkormann@castle.net (Joseph Kormann) writes: >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. I can't remember for sure, but isn't there a random number function in the Informix demo directory? Something like getrand.c, I think. Might save you reinventing the thing, if you end up with c code. Bryan Tonnet batonnet@zeta.org.au