Random.asm

This file contains the random number generator for PwnOS.

The algorithm is known as the Mersenne Twister, or MT19937.  See http://en.wikipedia.org/wiki/Mersenne_twister and http://www.math.sci.hiroshima-u.ac.jp- /~m-mat- /MT- /MT2002- /emt19937ar.html for details on the algorithm.

TODO: This needs mutual exclusion for multithreading.

Authors

  • Neil G.  Dickson
Summary
Random.asmThis file contains the random number generator for PwnOS.
Functions
InitializeRandomInitializes the RandomNumbers array based on the provided seed.
GetRandomNumberReturns a uniformly-distributed random integer between 0 and 0FFFFFFFFh
GenerateRandomRegenerates the RandomNumbers array after a pass though.
GetBoundedRandomNumberReturns a uniformly-distributed random integer between 0 (inclusive) and eax (exclusive)

Functions

InitializeRandom

Initializes the RandomNumbers array based on the provided seed.

Parameters

seedthe random seed

GetRandomNumber

Returns a uniformly-distributed random integer between 0 and 0FFFFFFFFh

GenerateRandom

Regenerates the RandomNumbers array after a pass though.

GetBoundedRandomNumber

Returns a uniformly-distributed random integer between 0 (inclusive) and eax (exclusive)