Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Random Number Generators
Replies: 1   Last Post: Dec 31, 1997 8:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Manish

Posts: 2
Registered: 12/7/04
Random Number Generators
Posted: Dec 31, 1997 7:36 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Deal all,

I have a query regarding the nature of rand() and randn() functions on
Matlab, a software I'm just starting out with.
How are the random number generators implemented? rand() on many computer
languages is a linear congruence generator with (of course) a finite
period. The period is dependent on an intelligent choice of constants (a,
b, c in the case shown below)

Typically, the linear congruence generator is

rand_no = ( a * prev_rand_no + b ) mod c
prev_rand_no = rand_no;

Obviously, c is the greatest random number possible.
To generate numbers between 0 and 1, the random number must then be
divided by (Rand_Max +1). For a good random generator, c = Rand_Max.

randn() may be implemented by transforming the uniform deviates generated
by rand() to normal random variables. The Box - Muller method is a
popular method.
How does Matlab go about generating its random numbers? What is the
period of rand()? I have to perform a simulation where the random number
generator is invoked lots of times, so these questions are critical to the
validity of my results.
Thank You for your help.

Cheers!
Manish.

------------------------------------------------------------------------------
Manish Kaul 43 University Road,
Electrical Engineering IV Singapore 297875.
National University of Singapore. Tel: 65 - 352 4574
------------------------------------------------------------------------------

Drink wet cement and get really stoned.





Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.