OpenCLLink`
OpenCLLink`

OpenCLMersenneTwister

OpenCLMersenneTwister[n]

generates n random reals using the Mersenne Twister algorithm.

Details and Options

  • 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

Examples

open allclose all

Basic Examples  (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 Language function, https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

Text

Wolfram Research (2010), OpenCLMersenneTwister, Wolfram Language function, https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

CMS

Wolfram Language. 2010. "OpenCLMersenneTwister." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/OpenCLLink/ref/OpenCLMersenneTwister.html.

APA

Wolfram Language. (2010). OpenCLMersenneTwister. Wolfram Language & System Documentation Center. Retrieved from 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: 18-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: 18-November-2024 ]}