time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (4045B)


      1 
      2 {{alias}}()
      3     Returns a pseudorandom number drawn from a standard normal distribution.
      4 
      5     The default underlying pseudorandom number generator (PRNG) *may* change in
      6     the future. If exact reproducibility is required, either use the `factory`
      7     method to explicitly specify a PRNG via the `name` option or use an
      8     underlying PRNG directly.
      9 
     10     Returns
     11     -------
     12     r: number
     13         Pseudorandom number.
     14 
     15     Examples
     16     --------
     17     > var r = {{alias}}();
     18 
     19 
     20 {{alias}}.factory( [options] )
     21     Returns a pseudorandom number generator (PRNG) for generating pseudorandom
     22     numbers drawn from a standard normal distribution.
     23 
     24     Parameters
     25     ----------
     26     options: Object (optional)
     27         Options.
     28 
     29     options.name: string (optional)
     30         Name of the underlying pseudorandom number generator (PRNG) that samples
     31         from a standard normal distribution. The following PRNGs are supported:
     32 
     33         - improved-ziggurat: improved ziggurat method.
     34         - box-muller: Box-Muller transform.
     35 
     36         Default: 'improved-ziggurat'.
     37 
     38     options.prng: Function (optional)
     39         Pseudorandom number generator (PRNG) for generating uniformly
     40         distributed pseudorandom numbers on the interval `[0,1)`. If provided,
     41         the `state` and `seed` options are ignored. In order to seed the
     42         returned pseudorandom number generator, one must seed the provided
     43         `prng` (assuming the provided `prng` is seedable).
     44 
     45     options.seed: any (optional)
     46         Pseudorandom number generator seed. Valid seed values vary according to
     47         the underlying PRNG.
     48 
     49     options.state: any (optional)
     50         Pseudorandom number generator state. Valid state values vary according
     51         to the underlying PRNG. If provided, the `seed` option is ignored.
     52 
     53     options.copy: boolean (optional)
     54         Boolean indicating whether to copy a provided pseudorandom number
     55         generator state. Setting this option to `false` allows sharing state
     56         between two or more pseudorandom number generators. Setting this option
     57         to `true` ensures that a returned generator has exclusive control over
     58         its internal state. Default: true.
     59 
     60     Returns
     61     -------
     62     rand: Function
     63         Pseudorandom number generator (PRNG).
     64 
     65     Examples
     66     --------
     67     // Basic usage:
     68     > var rand = {{alias}}.factory();
     69     > var r = rand();
     70     > r = rand();
     71 
     72     // Specify alternative PRNG:
     73     > var rand = {{alias}}.factory({ 'name': 'box-muller' });
     74     > r = rand();
     75     > r = rand();
     76 
     77 
     78 {{alias}}.NAME
     79     Generator name.
     80 
     81     Examples
     82     --------
     83     > var str = {{alias}}.NAME
     84     'randn'
     85 
     86 
     87 {{alias}}.PRNG
     88     Underlying pseudorandom number generator.
     89 
     90     Examples
     91     --------
     92     > var prng = {{alias}}.PRNG;
     93 
     94 
     95 {{alias}}.seed
     96     Pseudorandom number generator seed.
     97 
     98     Examples
     99     --------
    100     > var seed = {{alias}}.seed;
    101 
    102 
    103 {{alias}}.seedLength
    104     Length of generator seed.
    105 
    106     Examples
    107     --------
    108     > var len = {{alias}}.seedLength;
    109 
    110 
    111 {{alias}}.state
    112     Generator state.
    113 
    114     Examples
    115     --------
    116     > var r = {{alias}}()
    117     <number>
    118     > r = {{alias}}()
    119     <number>
    120     > r = {{alias}}()
    121     <number>
    122 
    123     // Get a copy of the current state:
    124     > var state = {{alias}}.state;
    125 
    126     > r = {{alias}}()
    127     <number>
    128     > r = {{alias}}()
    129     <number>
    130 
    131     // Set the state:
    132     > {{alias}}.state = state;
    133 
    134     // Replay the last two pseudorandom numbers:
    135     > r = {{alias}}()
    136     <number>
    137     > r = {{alias}}()
    138     <number>
    139 
    140 
    141 {{alias}}.stateLength
    142     Length of generator state.
    143 
    144     Examples
    145     --------
    146     > var len = {{alias}}.stateLength;
    147 
    148 
    149 {{alias}}.byteLength
    150     Size (in bytes) of generator state.
    151 
    152     Examples
    153     --------
    154     > var sz = {{alias}}.byteLength;
    155 
    156 
    157 {{alias}}.toJSON()
    158     Serializes the pseudorandom number generator as a JSON object.
    159 
    160     Returns
    161     -------
    162     out: Object
    163         JSON representation.
    164 
    165     Examples
    166     --------
    167     > var o = {{alias}}.toJSON()
    168     { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
    169 
    170     See Also
    171     --------
    172