>  Docs Center  >  Libraries  >  Coyote  >  RANDOMNUMBERGENERATOR__DEFINE
Libraries

RANDOMNUMBERGENERATOR__DEFINE

RANDOMNUMBERGENERATOR__DEFINE

Name


      RANDOMNUMBERGENERATOR

Purpose



      Allows the user to obtain a sequence of pseudo-random numbers. The
      object maintains the random number generator seed in such a way that
      subsequent calls to GetRandomNumbers will guarentee that you don't
      get the same random numbers each time you ask for random numbers.

Author



      FANNING SOFTWARE CONSULTING
      David Fanning, Ph.D.
      1645 Sheely Drive
      Fort Collins, CO 80526 USA
      Phone: 970-221-0438
      E-mail: david@idlcoyote.com
      Coyote's Guide to IDL Programming: http://www.idlcoyote.com

Category



      Utilities

Calling Sequence


 
      Generate three random numbers.
      IDL> rng = Obj_New('RandomNumberGenerator', initialSeed)
      IDL> numberOfNumbersNeeded = 3
      IDL> randomNumbers = rng -> GetRandomNumbers(numberOfNumbersNeeded)
      IDL> Print, randomNumbers
            0.80952855 0.35878432 0.52150406
           
      Generate a sequence of 8 random digits.
      IDL> Print, rng -> GetRandomDigits(8)
            21855786
  INPUT PARAMETERS FOR INIT METHOD:
      initialSeed: The initial seed for the random number generator. If undefined
                      or absent, the number of seconds after 1 January 1970 is used.
                     

Methods



      randomNumbers -> GetRandomNumbers(d1, d2, d3, d4 d5, d6, d7, d8)
      randomDigits = obj -> GetRandomDigits(numDigets)
      obj -> SetSeed, seed

Modification History



      Written by David W. Fanning, 13 November 2009.
      Added GetRandomDigits method. 7 February 2010. DWF.
      Incorrect cleanup of the seed pointer fixed in the CLEANUP procedure.
          25 February 2010, DWF.



© 2024 NV5 Geospatial Solutions, Inc. |  Legal
   Contact Us