× 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.


  • Subject: Re: CEERAN0 API
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Mon, 06 Nov 00 17:13:09 +1100


Hello Mike,

Its time to read Chapter 3 of Knuth's second volume.  Neither CEERAN0 nor the 
C-language 
rand() function generate truly 'random' numbers.  They generate psuedo-random 
numbers 
which are generated deterministically i.e., there is a direct relationship 
between one 
number and the previous number (and indeed the seed value).  The numbers are 
not actually 
random, they just appear to be random.  If you start with the same seed you 
will get the 
same sequence of numbers.

I believe both the above functions use different methods for generating the 
numbers, 
however they are uniformly distributed and may be considered statistically 
random.  Note 
that rand() returns integers in the range 0 to RAND_MAX (32767) while CEERAN0 
returns 
real numbers in the range 0 to 1.

You may be able to achieve your goal by changing the seed value on successive 
iterations.  
The seed could also be random number.  CEERAN0 allows you to use the current 
GMT as the 
seed by specifying a seed of zero -- you will need to set the seed to zero on 
each 
iteration since CEERAN0 updates the seed variable in preparation for the next 
call.

If neither of these functions are unsuitable for your purposes then you'll need 
to create 
your own generator but note the following quote from Knuth "... random numbers 
should not 
be generated with a method chosen at random ..."

Finally, something slightly more interesting than the free-format drivel!

Regards,
Simon Coulter.

«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
«» FlyByNight Software         AS/400 Technical Specialists       «»
«» Eclipse the competition - run your business on an IBM AS/400.  «»
«»                                                                «»
«» Phone: +61 3 9419 0175      Mobile: +61 0411 091 400           «»
«» Fax:   +61 3 9419 0175      mailto: shc@flybynight.com.au      «»
«»                                                                «»
«» Windoze should not be open at Warp speed.                      «»
«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»
+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.