time-to-botec

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

repl.txt (4390B)


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