Next: Introduction, Previous: (dir), Up: (dir) [Contents][Index]
This is the mt19937 Reference Manual, version 1.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Mon Aug 15 05:25:58 2022 GMT+0.
Next: Systems, Previous: The mt19937 Reference Manual, Up: The mt19937 Reference Manual [Contents][Index]
Introduction ============ MT19937 is a portable Mersenne Twister random number generator. It is mainly a modification of CMUCL's random number generator with all the CMUCL-specific parts taken out. It is faster than the JMT Mersenne Twister implementation, but significantly slower than native random number generators provided by major Common Lisp implementations. For light use this shouldn't be a problem, since it is still very fast. It should be very stable, since it's based on stable CMUCL code. It has been tested on CMUCL, SBCL, LispWorks, Allegro CL, GCL, CLISP, and Corman Lisp. What's the point? ================= Why, you might ask, would you want to use a portable, slower random number generator? The answer is consistancy. The portable version of this code was originally created for Maxima, a computer algebra system. They wanted the results of the random number generator to be portable across several implementations and platforms, so that if you used a certain seed on CMUCL the numbers generated would be the same as you would get with the same seed on GCL or CLISP. This was more important than achieving the maximum possible speed. You may have similar problems. Usage ===== MT19937 is a plug-in replacement for the Common Lisp random-number generator. The MT19937 package exports all the Common Lisp symbols related to random number generation, so you just need to load MT19937 and call its functions instead of the built-in ones. For example: ;; Load MT19937 (asdf:oos 'asdf:load-op :mt19937) ;; Make random numbers with your implementation's random ;; number generator. (random 1234567) (random 42.56) (random 3.1415d0) ;; Make random numbers using MT19937 (mt19937:random 1234567) (mt19937:random 42.56) (mt19937:random 3.1415d0) ;; MT19937 has its own random state (eq *random-state* mt19937:*random-state*) => nil License ======= MT19937 is in the public domain.
Next: Files, Previous: Introduction, Up: The mt19937 Reference Manual [Contents][Index]
The main system appears first, followed by any subsystem dependency.
Portable MT19937 Mersenne Twister random number generator
Douglas T. Crosher and Raymond Toy
Public domain
1.1
mt19937.lisp (file).
Next: Packages, Previous: Systems, Up: The mt19937 Reference Manual [Contents][Index]
Files are sorted by type and then listed depth-first from the systems components trees.
Next: mt19937/mt19937.lisp, Previous: Lisp, Up: Lisp [Contents][Index]
mt19937 (system).
Previous: mt19937/mt19937.asd, Up: Lisp [Contents][Index]
mt19937 (system).
Next: Definitions, Previous: Files, Up: The mt19937 Reference Manual [Contents][Index]
Packages are listed by definition order.
Next: mt19937-system, Previous: Packages, Up: Packages [Contents][Index]
common-lisp.
Next: Indexes, Previous: Packages, Up: The mt19937 Reference Manual [Contents][Index]
Definitions are sorted by export status, category, package, and then by lexicographic order.
Next: Internals, Previous: Definitions, Up: Definitions [Contents][Index]
Next: Compiler macros, Previous: Public Interface, Up: Public Interface [Contents][Index]
Next: Ordinary functions, Previous: Special variables, Up: Public Interface [Contents][Index]
Next: Structures, Previous: Compiler macros, Up: Public Interface [Contents][Index]
Handle the single or double float case of RANDOM. We generate a float
in [0d0, 1d0) by clobbering the mantissa of 1d0 with random bits (52 bits);
this yields a number in [1d0, 2d0). Then 1d0 is subtracted.
Handle the single or double float case of RANDOM. We generate a float
in [0f0, 1f0) by clobbering the mantissa of 1f0 with random bits (23 bits);
this yields a number in [1f0, 2f0). Then 1f0 is subtracted.
Generate an random state vector from the given SEED. The seed can be either an integer or a vector of (unsigned-byte 32)
Make a random state object. If STATE is not supplied, return a copy of the default random state. If STATE is a random state, then return a copy of STATE. If STATE is T then return a random state generated from the universal time. To make a random state from an integer seed, try “(make-random-object :state (init-random-state <seed>))”.
Generates a uniformly distributed pseudo-random number greater than or equal to zero and less than Arg. State, if supplied, is the random state to use.
Previous: Ordinary functions, Up: Public Interface [Contents][Index]
structure-object.
(simple-array (unsigned-byte 32) (627))
(mt19937:init-random-state)
Previous: Public Interface, Up: Definitions [Contents][Index]
Next: Ordinary functions, Previous: Internals, Up: Internals [Contents][Index]
Generates an integer greater than or equal to zero and less than Arg.
Successive chunks are concatenated without overlap to construct integers
larger than a single chunk. The return value has this property:
If two integers are generated from the same state with Arg equal to 2^m and 2^n,
respectively, then bit k is the same in both integers for 0 <= k < min(m,n).
Each call to %RANDOM-INTEGER consumes at least one chunk; bits left over
from previous chunks are not re-used.
Previous: Definitions, Up: The mt19937 Reference Manual [Contents][Index]
Jump to: | %
(
C F G I M R V |
---|
Jump to: | %
(
C F G I M R V |
---|
Next: Data types, Previous: Functions, Up: Indexes [Contents][Index]
Jump to: | *
C M R S |
---|
Jump to: | *
C M R S |
---|
Jump to: | F M P R S |
---|
Jump to: | F M P R S |
---|