RPGLE - Generate a random number
d instartnumber s 15 5
d inendnumber s 15 5
d inrandomnumber s 15 5
d wkseed s 9 9
d wkstartnumber s 6 0
d wkendnumber s 6 0
d wkrandomnumber s 6 0
d range s 6 0
d time s 12 0
c *entry plist
c parm instartnumber
c parm inendnumber
c parm inrandomnumber
*
c eval wkstartnumber = instartnumber
c eval wkendnumber = inendnumber
c eval wkrandomnumber = inrandomnumber
*
c if wkseed = *zeros
c time time
c .000000001 mult time wkseed
c endif
*
c if wkstartnumber = *zeros and
c wkendnumber = *zeros or
c wkendnumber < wkstartnumber
c eval wkstartnumber = 1
c eval wkendnumber = 999999
c endif
*
c eval range = (wkendnumber -wkstartnumber) + 1
*
c mult 9821 wkseed
c add .211327 wkseed
c eval wkrandomnumber = (wkseed * range) +
c wkstartnumber
c eval *inlr = *on
No comments:
Post a Comment