WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

$RandomGeneratorState

gives a representation of the internal state of the default pseudorandom generator.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Applications  
Properties & Relations  
See Also
Related Guides
History
Cite this Page

$RandomGeneratorState

gives a representation of the internal state of the default pseudorandom generator.

Details

Examples

open all close all

Basic Examples  (1)

Get the current state of the pseudorandom generator:

Applications  (1)

Create a version of BlockRandom that refuses to run if the current random state cannot be restored:

Activate a randomness generation method with no restorable state:

Because this method cannot be seeded, BlockRandom cannot give reproducible results:

The function will refuse to evaluate:

Activate a randomness generation method that possesses a restorable state:

The function restores the random state at the end of each evaluation:

Hence the following result matches the previous result:

Properties & Relations  (4)

$RandomGeneratorState returns a RandomGeneratorState object:

Using RandomInteger , RandomReal and related functions changes $RandomGeneratorState :

Use RandomComplex :

The state has changed as indicated by the new hash:

The value of $RandomGeneratorState can be restored with SeedRandom :

Restoring $RandomGeneratorState after a computation is effectively the same as BlockRandom :

Wolfram Research (2020), $RandomGeneratorState, Wolfram Language function, https://reference.wolfram.com/language/ref/$RandomGeneratorState.html.

Text

Wolfram Research (2020), $RandomGeneratorState, Wolfram Language function, https://reference.wolfram.com/language/ref/$RandomGeneratorState.html.

CMS

Wolfram Language. 2020. "$RandomGeneratorState." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/$RandomGeneratorState.html.

APA

Wolfram Language. (2020). $RandomGeneratorState. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/$RandomGeneratorState.html

BibTeX

@misc{reference.wolfram_2025_$randomgeneratorstate, author="Wolfram Research", title="{$RandomGeneratorState}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/$RandomGeneratorState.html}", note=[Accessed: 08-January-2026]}

BibLaTeX

@online{reference.wolfram_2025_$randomgeneratorstate, organization={Wolfram Research}, title={$RandomGeneratorState}, year={2020}, url={https://reference.wolfram.com/language/ref/$RandomGeneratorState.html}, note=[Accessed: 08-January-2026]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /