By Kardi Teknomo, PhD .

Monte Carlo Simulation Tutorial

< Previous | Next | Contents >

Generating Uniform Distribution using Pseudo Random

Primitive of random number for Monte Carlo Simulation is distributed according to Uniform distribution with PDF

Monte Carlo Simulation Tutorial ,

where Monte Carlo Simulation Tutorial is the boundary of the distribution. The inverse distribution function is given by

Monte Carlo Simulation Tutorial

The figure below show the visual distribution of MS Excel Uniform Random number. Its clearly distributed according to standard uniform distribution.

Monte Carlo Simulation Tutorial

The Monte Carlo Simulation Tutorial must be distributed as standard uniform distribution with range zero to one.

Just in case you need to generate it by yourselves, consider the following explanation. The most widely used of pseudo random generator is to produce standard uniform distribution Monte Carlo Simulation Tutorial using Linear Congruential Generator of Lehmer introduce in 1951:

Monte Carlo Simulation Tutorial

Monte Carlo Simulation Tutorial returns the remainder of division Monte Carlo Simulation Tutorial . The formula gives a sequence of integers, all different numbers, up to Monte Carlo Simulation Tutorial elements. To make longest sequence, we make this value as large as possible. We can set this value as the number of storage for integer variables. Suppose we use 32 bits, then Monte Carlo Simulation Tutorial . Most commonly use constants is Monte Carlo Simulation Tutorial and Monte Carlo Simulation Tutorial .

The seed value of pseudorandom represents the start of sequence Monte Carlo Simulation Tutorial . To make it random usually we need to randomize the initial seed.

Most of programming languages have random number function to generate uniform distribution. Below are a few lists of programming language or software and its pseudorandom number. Most of random number generated are in the interval of 0 and 1 (except C/C++ which generate integer random number)

Programming Language/Software

PseudoRandom number function

Note

Visual Basic or Visual Basic for Application (VBA)

Rnd( seed)

Use Randomize to initialize seed

Matlab

rand( matrix_size )

Generate a matrix of random numbers

MathCad

rnd(x)

Random number between 0 and x

Visual C/C++

rand()

It generates integer 0 to RAND_MAX rather than number between 0 and 1; Include <stdlib.h> , use srand( seed ) to initialize

Java

Math.random

java.lang.Math

Visual FoxPro

Rand ( seed )

Use seed value first time only

Mathematica

Random[ type , range ]

Use SeedRandom[ seed ] to reset the seed

MS Excel worksheet

= RAND ()

< Previous | Next | Contents >

Give your comments, questions or suggestions for this tutorial

This tutorial is copyrighted .

Preferable reference for this tutorial is

Teknomo, Kardi. Monte Carlo Simulation Tutorial. http://people.revoledu.com/kardi/ tutorial/Simulation