OpenCLMersenneTwister

OpenCLMersenneTwister[n]
generates n random reals using the Mersenne Twister algorithm.

DetailsDetails

  • 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

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

First, load the OpenCLLink application:

In[1]:=
Click for copyable input

This generates 50 random reals:

In[2]:=
Click for copyable input
Out[2]=

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

In[1]:=
Click for copyable input
Out[1]=

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

In[1]:=
Click for copyable input
Out[1]=

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:

In[1]:=
Click for copyable input
Out[1]=
New to Mathematica? Find your learning path »
Have a question? Ask support »