Anyone know where I can find one?
Thanks....
Jim Donahue
James....@ParamountParks.com
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
If you're using ILE RPG you can use the API below.
System API Reference
OS/400 Integrated Language Environment (ILE) CEE APIs
Version 4
Document Number SC41-5861-01
5.7.1 Basic Random Number Generation (CEERAN0) API
The Basic Random Number Generation (CEERAN0) API generates a sequence of uniform pseudorandom
numbers between 0 and 1 using the multiplicative
congruential method with a user-specified seed.
Njål Fisketjøn, FIGU DATA AS
n...@figu.no
http://www.robin.no/~nfisketj
I just sent it to the webmaster for refresh. You can download the math
service program (Math.zip - might want to wait a little while to make
sure the update gets there!) by clicking the following link
http://www.news400.com/TheRPGSource/Utilities/Math.zip
or by visiting The RPG Source Website at
http://www.news400.com/TheRPGSource and following the link to the
Download Utilities section.
Gary Guthrie
Editor, The RPG Source at http://www.news400.com/TheRPGSource
Technical Editor, NEWS/400 at http://www.news400.com
- - -
JDonahue wrote in message <7j66bu$hoq$1...@nnrp1.deja.com>...
This should do the trick... (compile with DFTACTGRP(*NO))
DRandomize PR ExtProc('CEERAN0')
D pSeed 9B 0
D pRand 8F
DSeed S 9B 0 Inz
DRand S 8F Inz
C CallP Randomize(Seed:Rand)
Rand will contain a random number between 0 and 1.
Regards,
Paul
-----------
JDonahue wrote in message <7j66bu$hoq$1...@nnrp1.deja.com>...
Hi There! I'm looking for a compact random number generator that I can
plunk into some RPG code. I realize that the number probably isn't
random, but I'd like to get as close as possible. I've thought about
taking the time in seconds and multiplying that by *LOVAL, but I want
to see if anyone has a slick set of code already written that I can get
by begging real hard. It would be nice if I could tell this routine how
big a number I want and/or a high/low range.
Anyone know where I can find one?
Thanks....
Jim Donahue
James....@ParamountParks.com
The contents of this message express only the sender's opinion.
This message does not necessarily reflect the policy or views of
my employer, Merck & Co., Inc. All responsibility for the statements
made in this Usenet posting resides solely and completely with the
sender.
Try info found in DejaNews search for CEERAN0; as above.
Regards, Chuck
All comments provided "as is" with no warranties of any kind whatsoever.
I have one based on an algorithm published in the Communications of the
ACM that is very random. It was originally used to randomly select
employees for drug testing. We needed an algorithm that would hold up
in a court of law as being "mathematically proven."
For less rigourous applications, I'd stick with CEERAN0. It's easy to
work with and less cumbersome to code for.
Buck Calabro
Billing Concepts Albany, NY
mailto:mcal...@commsoft.net
JDonahue <jgdo...@my-deja.com> wrote in article
<7j66bu$hoq$1...@nnrp1.deja.com>...
> Hi There! I'm looking for a compact random number generator that I can
> plunk into some RPG code. I realize that the number probably isn't
> random, but I'd like to get as close as possible. I've thought about
> taking the time in seconds and multiplying that by *LOVAL, but I want
> to see if anyone has a slick set of code already written that I can get
> by begging real hard. It would be nice if I could tell this routine how
> big a number I want and/or a high/low range.
>
> Anyone know where I can find one?
>
> Thanks....
>
> Jim Donahue
> James....@ParamountParks.com
>
>
Saludos
Christian Podesta Carlevaris wrote in message
<375A792B...@mbox.servicenet.com.ar>...
D/COPY QSYSINC/QRPGLESRC,QUSEC
*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D w_time S 6 0
*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
D p_seed S 4B 0
D p_RANO S 8F
D api_ERR S LIKE(QUSEC)
********************************************************************
C TIME w_TIME
C Z-ADD w_TIME p_SEED
*
C CALLB 'CEERAN0'
C PARM p_seed
C PARM p_rano
C PARM api_ERR
*
C SETON LR
HTH
Best regards
Pete M. (MJS400 Ltd)
An alternative is to use ILE RPG for which there is a random number
bindable API. Look in the Math API's manual to find it.
In article <375A792B...@mbox.servicenet.com.ar>, Christian Podesta
Carlevaris <bar...@mbox.servicenet.com.ar> writes
>Usin CL there is a command... can't remember now how it's called but
>you can give it a seed and a range.
>
>Saludos
>
>Donna Bryant wrote:
>>
>> You can call a REXX program. There is a REXX function that returns a
>> random number.
>> -donna bryant
>>
>> JDonahue <jgdo...@my-deja.com> wrote in article
>> <7j66bu$hoq$1...@nnrp1.deja.com>...
>> > Hi There! I'm looking for a compact random number generator that I can
>> > plunk into some RPG code. I realize that the number probably isn't
>> > random, but I'd like to get as close as possible. I've thought about
>> > taking the time in seconds and multiplying that by *LOVAL, but I want
>> > to see if anyone has a slick set of code already written that I can get
>> > by begging real hard. It would be nice if I could tell this routine how
>> > big a number I want and/or a high/low range.
>> >
>> > Anyone know where I can find one?
>> >
>> > Thanks....
>> >
>> > Jim Donahue
>> > James....@ParamountParks.com
>> >
>> >
>> > Sent via Deja.com http://www.deja.com/
>> > Share what you know. Learn what you don't.
>> >
--
Chris
Chris wrote in message ...