× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




I'll be interested to hear on this one... I don't know any specifics on
your question, but my reading has always led me to believe that it's very
difficult to have a program that gives truly random results...





"Emily Smith"
<esmith@bankdatas
ervices.com> To
Sent by: <midrange-l@xxxxxxxxxxxx>
midrange-l-bounce cc
s@xxxxxxxxxxxx
Subject
random number generator oddity
12/04/2008 04:40
PM


Please respond to
Midrange Systems
Technical
Discussion
<midrange-l@midra
nge.com>






List,

We have a program that uses 'rand' to generate random numbers. I call this
program requesting an eight byte number and receive a number 81239122. I
sign off, and a coworker signs onto my workstation he also calls the
program requesting an eight byte number, and also receives 81239122. He
signs off, I sign back on, run the same program and receive a completely
different number 73449833. I sign off. He signs back on again calls the
program and receives 81239712.

So we've been testing this for about an hour using different scenarios (one
of us signs in at the same workstation and calls the program then signs off
and the other signs on, we sign in at the same time to different
workstations and call the program simultaneously, one signs in at one
workstation calls the program and then signs off the other signs on to a
second workstation and calls the program etc.) multiple times. Sometimes,
we would each get a random number that was the same as the other. Other
times the numbers would be completely different. Still other times the
first four or six digits would be the same but the last two or four would
be the same.
Could anyone shed any light as to how 'rand' works and why it doesn't seem
to truly generate a random number? Is there something wrong with the
program that uses 'rand' to generate the random number?

Here is the code of the program that generates the random number.
D Number S 99 varying
D Length S 2 0
D A S 4 0
D X S 4 0
D digit S 4 dim(16)
D GetRandom PR 10U 0 ExtProc('rand')
C *entry Plist
C parm number
C Eval length = %LEN(Number)
C Eval X = (length / 4) + 1
C Eval A = 1
C Do X
C Eval digit(a) = %CHAR(GetRandom)
C Eval A = A + 1
C Enddo
C eval number = %trimr(digit(1))
C + %trimr(digit(2))
C + %trimr(digit(3))
C + %trimr(digit(4))
C + %trimr(digit(5))
C + %trimr(digit(6))
C + %trimr(digit(7))
C + %trimr(digit(8))
C + %trimr(digit(9))
C + %trimr(digit(10))
C + %trimr(digit(11))
C + %trimr(digit(12))
C + %trimr(digit(13))
C + %trimr(digit(14))
C + %trimr(digit(15))
C + %trimr(digit(16))
C Return

Thanks for all feedback.



Emily Smith
Programmer/Analyst
Bank Data Services
(618)659-4550
CONFIDENTIALITY NOTICE: This email message is private, confidential
property of the sender, and the materials may be privileged communications
intended solely for the receipt, use, benefit, and information of the
intended recipient indicated above. If you are not the intended recipient,
you are hereby notified that any review, disclosure, distribution, copying,
or taking of any other action in reference to the contents of this message
is strictly prohibited, and may result in legal liability on your part. If
you have received this message in error, please notify the sender
immediately and delete this message from your system. We believe that this
email and any attachments are free of any virus or other defect that might
affect any computer system that it is received and opened in, however, it
is the responsibility of the recipient to ensure that it is virus free and
the sender accepts no responsibility for any loss or damage.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.