| Author |
How to create a random number generator
|
|
| xmail123@yahoo.com 2005-04-07, 8:05 pm |
|
Can any one give me any suggestions on how to create a random number
generator given a seed, max value and min value. I want the return
value to be an integer.
Thanks
| |
|
| Hi,
You may want to have a look at the RAND() function.
hth
Mark
"xmail123@yahoo.com" wrote:
>
> Can any one give me any suggestions on how to create a random number
> generator given a seed, max value and min value. I want the return
> value to be an integer.
>
> Thanks
>
>
| |
| Rick Bean 2005-04-07, 8:05 pm |
| This is one I've used successfully:
FUNCTION GetRandom
LPARAMETERS pnMin, pnMax
RETURN INT((pnMax - pnMin + 1) * RAND( ) + pnMin)
Note: You should always do a RAND(-1) before you call this routine to =
intiallize the random seed.
Rick
<xmail123@yahoo.com> wrote in message =
news:424a2123.690312727@127.0.0.1...
>=20
> Can any one give me any suggestions on how to create a random number
> generator given a seed, max value and min value. I want the return
> value to be an integer.
>=20
> Thanks
>
| |
| xmail123@yahoo.com 2005-04-07, 8:05 pm |
| On Wed, 30 Mar 2005 11:03:31 -0500, "Rick Bean"
< rgbean@unrealmelange
-inc.com> wrote:
[color=darkred]
>This is one I've used successfully:
>
>FUNCTION GetRandom
>LPARAMETERS pnMin, pnMax
>RETURN INT((pnMax - pnMin + 1) * RAND( ) + pnMin)
>
>Note: You should always do a RAND(-1) before you call this routine to =
>intiallize the random seed.
>
>Rick
>
><xmail123@yahoo.com> wrote in message =
>news:424a2123.690312727@127.0.0.1...
| |
| xmail123@yahoo.com 2005-04-07, 8:05 pm |
| Thank you very much. Problem solved. :)
On Wed, 30 Mar 2005 11:03:31 -0500, "Rick Bean"
< rgbean@unrealmelange
-inc.com> wrote:
[color=darkred]
>This is one I've used successfully:
>
>FUNCTION GetRandom
>LPARAMETERS pnMin, pnMax
>RETURN INT((pnMax - pnMin + 1) * RAND( ) + pnMin)
>
>Note: You should always do a RAND(-1) before you call this routine to =
>intiallize the random seed.
>
>Rick
>
><xmail123@yahoo.com> wrote in message =
>news:424a2123.690312727@127.0.0.1...
|
|
|
|