OpenCLLink`
OpenCLLink`

OpenCLMersenneTwister

OpenCLMersenneTwister[n]

generates n random reals using the Mersenne Twister algorithm.

更多信息和选项

  • The OpenCLLink application must be loaded using Needs["OpenCLLink`"].
  • The following options can be given:
  • "Device"Automaticdevice on which OpenCL computation is performed
    "Platform"Automaticplatform on which OpenCL computation is performed
    "SeedFile"Nonefile containing the initial state of the random number generator
    "SeedValue"Automaticseed value for the random number generator; a random integer is used if set to Automatic

范例

打开所有单元关闭所有单元

基本范例  (4)

First, load the OpenCLLink application:

This generates 50 random reals:

This generates 50 random reals, setting the initial state from a file:

This generates 50 random reals, setting the seed value from an integer:

This generates 50 random reals, setting the seed value from an integer and the state from a file, returning the same random numbers on each call:

Neat Examples  (1)

Use OpenCLMersenneTwister for Monte Carlo simulation. In this case the value of is found using 500,000 random numbers:

You can plot to see the points that approximate a quarter of the area of the unit circle:

Wolfram Research (2010),OpenCLMersenneTwister,Wolfram 语言函数,https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

文本

Wolfram Research (2010),OpenCLMersenneTwister,Wolfram 语言函数,https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

CMS

Wolfram 语言. 2010. "OpenCLMersenneTwister." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

APA

Wolfram 语言. (2010). OpenCLMersenneTwister. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html 年

BibTeX

@misc{reference.wolfram_2024_openclmersennetwister, author="Wolfram Research", title="{OpenCLMersenneTwister}", year="2010", howpublished="\url{https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html}", note=[Accessed: 21-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_openclmersennetwister, organization={Wolfram Research}, title={OpenCLMersenneTwister}, year={2010}, url={https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html}, note=[Accessed: 21-November-2024 ]}