Docsity

Random Variables and Number Generation in Computer Simulation - Prof. Paul A. Fishwick, Study notes of Computer Science

Toggle sidebar
bg1
CAP 4800/5805 Computer Simulation Concepts
Lecture 6
Random variables
• Probabilistic measures are important to simulation since it is often possible to define
the frequency associated with some dynamical process.
• A random variable can have a range of possible values where a value is called a
random number (RN)
• RN is obtained by sampling the distribution that defines the random variable.
• Discrete or Continuous
• A random variable differs from a variable
Operation Variable Random variable
get X Æ value Sample X Æ value
store X Å value X Å function with value range
- get: obtain the value of a variable
- store: put a new value into a variable
Generation random numbers (RN)
• Uniform distribution: a probability distribution function that is flat or constant
across the range of values that a random variable will assume.
• For instance, to generate random numbers in the range [0,1) for a uniform
distribution function, we would expect any number in [0,1) to be likely as any other
number when a number is picked
• If we know how to generate random numbers u ∈ [0,1) and we desire a uniform
random distribution between A and B, we can generate y from u by the following
y = A + (B – A) u, where y ∈ [A,B) and u ∈ [0,1)
pf3

Partial preview of the text

Download Random Variables and Number Generation in Computer Simulation - Prof. Paul A. Fishwick and more Study notes Computer Science in PDF only on Docsity!

CAP 4800/5805 Computer Simulation Concepts

Lecture 6

Random variables

  • Probabilistic measures are important to simulation since it is often possible to define the frequency associated with some dynamical process.
  • A random variable can have a range of possible values where a value is called a random number (RN)
  • RN is obtained by sampling the distribution that defines the random variable.
  • Discrete or Continuous
  • A random variable differs from a variable Operation Variable Random variable get X Æ value Sample X Æ value store X Å value X Å function with value range
    • get: obtain the value of a variable
    • store: put a new value into a variable

Generation random numbers (RN)

  • Uniform distribution: a probability distribution function that is flat or constant across the range of values that a random variable will assume.
  • For instance, to generate random numbers in the range [0,1) for a uniform distribution function, we would expect any number in [0,1) to be likely as any other number when a number is picked
  • If we know how to generate random numbers u ∈ [0,1) and we desire a uniform random distribution between A and B, we can generate y from u by the following y = A + (B – A) u , where y ∈ [A,B) and u ∈ [0,1)

Nonuniform random number generation

  • Inverse Method for Nonuniform RNs Procedure Main 1a. Specify the nonuniform distribution 1b. Discretize distribution if it is continuous (using a sampling method) 2. Create a cumulative distribution (CD) from the discrete distribution 3. Calculate the inverse of the CD function either using a table or a direct solution method 4. Use a uniform distribution random number generator to generate a number (N) between 0 and 1 5. Use N as the probability for the CD probability and locate the corresponding range value in T End Main