Mersenne Twister Source Code Test Program
|
|
URI:
|
http://herbert.gandraxa.com/herbert/rng_test.asp
|
|
Link template:
|
<a href="http://herbert.gandraxa.com/herbert/rng_test.asp">Mersenne Twister Source Code Test Program</a>
|
|
|
Link symbols:
|
On current page |
On this site |
On external site |
Wikipedia article |
ZIP archive |
PDF |
E-Mail
|
Article
Organization
Home »
Linoleum Source Code »
Mersenne Twister »
Source Code Test Program
Scope
This is the source code of the Mersenne Twister Test Program, testing the Mersenne Twister library, implemented in the
Linoleum programming language.
Author
Herbert Glarner
Usage
This test program measures the performance of the
RNG library.
Make sure you have the library named rng.txt in the same folder as this test program before assembling the latter.
Run the assembled exe and measure the time it takes. Whole seconds will do. The test program calculates 2 billion pseudo random numbers. Take the average time of at least 10 runs. If you have a different machine than those listed on the
RNG page, you might want to let me know your results, in order to publish them there.
Source Code
(Test application, using the Memory Library Routines "Ram.txt".)
(*****************************************************************************)
(Routines summary:
Name of routine Short description
)
(*****************************************************************************)
"libraries"
RNG; (Random Number Generator)
(*****************************************************************************)
"directors"
program name = { RNG_Test };
unit = 32;
pointer mode = BY COORDINATE;
(*****************************************************************************)
"constants" (Convention: "TST ...", UPPER CASE)
(*****************************************************************************)
"variables" (Convention: "tst ...", lower case)
(*****************************************************************************)
"workspace" (Convention: "tst ...", lower case)
rng init key = 4;
(*****************************************************************************)
"programme" (Convention: "Tst ...", Mixed case)
(=========================================================================)
[rng init key plus 0] = 123h;
[rng init key plus 1] = 234h;
[rng init key plus 2] = 345h;
[rng init key plus 3] = 456h;
E = rng init key; (Address of init key)
D = 4; (Length of init key)
=> Rng Init;
(Speed on Pentium 4 with 1,328 MHz: 500 million numbers in 17 seconds)
(Speed on Celeron D 346 with 3,066 MHz: 2 billion numbers in 28 seconds)
B = 200 000 000; (200 million x 10 numbers = 2 billion)
"rng test skip blocks"
(Unrolled loop at 10 numbers)
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
=> Rng Long;
B ^ rng test skip blocks;
show registers;
(=========================================================================)
(*****************************************************************************)
Linoleum Syntax Highlighting produced with LSH (© 2007 by Herbert Glarner)