How To Generate A Random Number

How To Generate A Random Number - How To Generate A Random...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
How To Generate A Random Number. .. Use the following routines found in random.asm to initialize, set, and get random numbers: Function Parameters Description initRand16 IN: r12 = random seed Initialize random # generator rand16 OUT: r12 = random number (0-32767) Get 16-bit random # setRandSeed IN: r12 = random seed Set random # seed getRandSeed OUT: r12 = random number seed Get current random # seed A pseudorandom number generator (PRNG) is an algorithm for generating a sequence of numbers that approximates the properties of random numbers. The sequence is not truly random in that it is completely determined by an initial value, called the PRNG's state or seed. Although sequences that are closer to truly random can be generated using hardware random number generators, pseudorandom numbers are important in practice for simulations and are central in the practice of cryptography and procedural generation. A pseudorandom number generator can be started from an arbitrary starting state using a seed state. It will always produce the same sequence thereafter when initialized with that state. The maximum length of the sequence before it
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 02/08/2012.

Page1 / 4

How To Generate A Random Number - How To Generate A Random...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online