$RandomGeneratorState
デフォルトの擬似乱数生成器の内部状態表現を与える.
詳細
- $RandomGeneratorStateは,BlockRandom,SeedRandomおよび関連関数に渡すことができるRandomGeneratorStateオブジェクトを返す.
例題
すべて開く すべて閉じるアプリケーション (1)
現行の乱数状態が回復できない場合は実行を拒否するBlockRandomのバージョンを作る:
SetAttributes[myBlockRandom, HoldFirst];
myBlockRandom[args__] := If[$RandomGeneratorState["StateHash"] =!= None,
BlockRandom[args],
"Aborting as the active method has no restorable state."]SeedRandom["Method" -> "OpenSSL"]このメソッドにはシードすることができないので,BlockRandomは回復可能な結果を与えることができない:
SeedRandom[1234, "Method" -> "OpenSSL"]myBlockRandom[RandomReal[]]SeedRandom["Method" -> "ExtendedCA"]myBlockRandom[RandomReal[]]myBlockRandom[RandomReal[]]特性と関係 (4)
$RandomGeneratorStateはRandomGeneratorStateオブジェクトを返す:
$RandomGeneratorState//HeadRandomRealおよび関連関数は,RandomIntegerを使って$RandomGeneratorStateを変更する:
$RandomGeneratorStateRandomComplexを使う:
RandomComplex[]$RandomGeneratorState$RandomGeneratorStateの値はSeedRandomで回復できる:
state = $RandomGeneratorState;
RandomInteger[100, 10]SeedRandom[state];
RandomInteger[100, 10]計算の後で$RandomGeneratorStateを回復することは,事実上BlockRandomと同じである:
Table[Block[{state, result}, state = $RandomGeneratorState;result = RandomInteger[100];SeedRandom[state];result], {5}]Table[BlockRandom[RandomInteger[100]], {5}]テキスト
Wolfram Research (2020), $RandomGeneratorState, Wolfram言語関数, 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_2026_$randomgeneratorstate, author="Wolfram Research", title="{$RandomGeneratorState}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/$RandomGeneratorState.html}", note=[Accessed: 14-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_$randomgeneratorstate, organization={Wolfram Research}, title={$RandomGeneratorState}, year={2020}, url={https://reference.wolfram.com/language/ref/$RandomGeneratorState.html}, note=[Accessed: 14-August-2026]}