time-to-botec

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

repl.txt (4377B)


      1 
      2 {{alias}}( a, b, c )
      3     Returns a pseudorandom number drawn from a triangular distribution.
      4 
      5     If the condition `a <= c <= b` is not satisfied, the function returns `NaN`.
      6 
      7     If either `a`, `b`, or `c` is `NaN`, the function returns `NaN`.
      8 
      9     Parameters
     10     ----------
     11     a: number
     12         Minimum support.
     13 
     14     b: number
     15         Maximum support.
     16 
     17     c: number
     18         Mode.
     19 
     20     Returns
     21     -------
     22     r: integer
     23         Pseudorandom number.
     24 
     25     Examples
     26     --------
     27     > var r = {{alias}}( 2.0, 5.0, 3.33 );
     28 
     29 
     30 {{alias}}.factory( [a, b, c, ][options] )
     31     Returns a pseudorandom number generator (PRNG) for generating pseudorandom
     32     numbers drawn from a triangular distribution.
     33 
     34     If provided `a`, `b`, and `c`, the returned PRNG returns random variates
     35     drawn from the specified distribution.
     36 
     37     If not provided `a`, `b`, and `c`, the returned PRNG requires that `a`, `b`,
     38     and `c` be provided at each invocation.
     39 
     40     Parameters
     41     ----------
     42     a: number (optional)
     43         Minimum support.
     44 
     45     b: number (optional)
     46         Maximum support.
     47 
     48     c: number (optional)
     49         Mode.
     50 
     51     options: Object (optional)
     52         Options.
     53 
     54     options.prng: Function (optional)
     55         Pseudorandom number generator (PRNG) for generating uniformly
     56         distributed pseudorandom numbers on the interval `[0,1)`. If provided,
     57         the `state` and `seed` options are ignored. In order to seed the
     58         returned pseudorandom number generator, one must seed the provided
     59         `prng` (assuming the provided `prng` is seedable).
     60 
     61     options.seed: integer|ArrayLikeObject<integer> (optional)
     62         Pseudorandom number generator seed. The seed may be either a positive
     63         unsigned 32-bit integer or, for arbitrary length seeds, an array-like
     64         object containing unsigned 32-bit integers.
     65 
     66     options.state: Uint32Array (optional)
     67         Pseudorandom number generator state. If provided, the `seed` option is
     68         ignored.
     69 
     70     options.copy: boolean (optional)
     71         Boolean indicating whether to copy a provided pseudorandom number
     72         generator state. Setting this option to `false` allows sharing state
     73         between two or more pseudorandom number generators. Setting this option
     74         to `true` ensures that a returned generator has exclusive control over
     75         its internal state. Default: true.
     76 
     77     Returns
     78     -------
     79     rand: Function
     80         Pseudorandom number generator (PRNG).
     81 
     82     Examples
     83     --------
     84     // Basic usage:
     85     > var rand = {{alias}}.factory();
     86     > var r = rand( 0.0, 1.0, 0.5 );
     87     > r = rand( -2.0, 2.0, 1.0 );
     88 
     89     // Provide `a`, `b`, and `c`:
     90     > rand = {{alias}}.factory( 0.0, 1.0, 0.5 );
     91     > r = rand();
     92     > r = rand();
     93 
     94 
     95 {{alias}}.NAME
     96     Generator name.
     97 
     98     Examples
     99     --------
    100     > var str = {{alias}}.NAME
    101     'triangular'
    102 
    103 
    104 {{alias}}.PRNG
    105     Underlying pseudorandom number generator.
    106 
    107     Examples
    108     --------
    109     > var prng = {{alias}}.PRNG;
    110 
    111 
    112 {{alias}}.seed
    113     Pseudorandom number generator seed.
    114 
    115     Examples
    116     --------
    117     > var seed = {{alias}}.seed;
    118 
    119 
    120 {{alias}}.seedLength
    121     Length of generator seed.
    122 
    123     Examples
    124     --------
    125     > var len = {{alias}}.seedLength;
    126 
    127 
    128 {{alias}}.state
    129     Generator state.
    130 
    131     Examples
    132     --------
    133     > var r = {{alias}}( 0.0, 1.0, 0.5 )
    134     <number>
    135     > r = {{alias}}( 0.0, 1.0, 0.5 )
    136     <number>
    137     > r = {{alias}}( 0.0, 1.0, 0.5 )
    138     <number>
    139 
    140     // Get a copy of the current state:
    141     > var state = {{alias}}.state
    142     <Uint32Array>
    143 
    144     > r = {{alias}}( 0.0, 1.0, 0.5 )
    145     <number>
    146     > r = {{alias}}( 0.0, 1.0, 0.5 )
    147     <number>
    148 
    149     // Set the state:
    150     > {{alias}}.state = state;
    151 
    152     // Replay the last two pseudorandom numbers:
    153     > r = {{alias}}( 0.0, 1.0, 0.5 )
    154     <number>
    155     > r = {{alias}}( 0.0, 1.0, 0.5 )
    156     <number>
    157 
    158 
    159 {{alias}}.stateLength
    160     Length of generator state.
    161 
    162     Examples
    163     --------
    164     > var len = {{alias}}.stateLength;
    165 
    166 
    167 {{alias}}.byteLength
    168     Size (in bytes) of generator state.
    169 
    170     Examples
    171     --------
    172     > var sz = {{alias}}.byteLength;
    173 
    174 
    175 {{alias}}.toJSON()
    176     Serializes the pseudorandom number generator as a JSON object.
    177 
    178     Returns
    179     -------
    180     out: Object
    181         JSON representation.
    182 
    183     Examples
    184     --------
    185     > var o = {{alias}}.toJSON()
    186     { 'type': 'PRNG', 'name': '...', 'state': {...}, 'params': [] }
    187 
    188     See Also
    189     --------
    190