1515* See the License for the specific language governing permissions and
1616* limitations under the License.
1717*/
18-
18+
1919// TypeScript Version: 4.1
20-
20+
2121/// <reference types="@stdlib/types"/>
22-
22+
2323/**
2424* Interface defining `factory` options.
2525*/
@@ -28,18 +28,18 @@ interface Options {
2828 * Pseudorandom number generator seed.
2929 */
3030 seed ?: number | bigint ;
31-
31+
3232 /**
3333 * Pseudorandom number generator state.
3434 */
3535 state ?: Array < bigint > ;
36-
36+
3737 /**
3838 * Specifies whether to copy a provided pseudorandom number generator state.
3939 */
4040 copy ?: boolean ;
4141}
42-
42+
4343/**
4444* Interface for PRNG properties and methods.
4545*/
@@ -48,30 +48,30 @@ interface PRNG {
4848 * Generator name.
4949 */
5050 readonly NAME : string ;
51-
51+
5252 /**
5353 * PRNG seed.
5454 */
5555 readonly seed : bigint ;
56-
56+
5757 /**
5858 * PRNG state.
5959 */
6060 state : Array < bigint > ;
61-
61+
6262 /**
6363 * Serializes the pseudorandom number generator as a JSON object.
6464 *
6565 * @returns JSON representation
6666 */
6767 toJSON ( ) : {
68- type : string ;
69- name : string ;
70- state : Array < bigint > ;
71- params : Array < unknown > ;
72- } ;
68+ type : string ;
69+ name : string ;
70+ state : Array < bigint > ;
71+ params : Array < unknown > ;
72+ } ;
7373}
74-
74+
7575/**
7676* Interface for generating pseudorandom 64-bit unsigned integers.
7777*/
@@ -82,27 +82,26 @@ interface NullaryFunction extends PRNG {
8282 * @returns pseudorandom number
8383 */
8484 ( ) : bigint ;
85-
85+
8686 /**
8787 * Returns a pseudorandom number on the interval `[0,1)`.
8888 *
8989 * @returns pseudorandom number
9090 */
9191 normalized ( ) : number ;
92-
92+
9393 /**
9494 * Returns a copy of the PRNG.
9595 *
9696 * @returns copy of the PRNG
9797 */
9898 copy ( ) : NullaryFunction ;
9999}
100-
100+
101101/**
102102* Interface for the xorshift128+ PRNG factory.
103103*/
104- interface Factory {
105- /**
104+ /**
106105 * Returns a xorshift128+ pseudorandom number generator.
107106 *
108107 * @param options - function options
@@ -124,9 +123,8 @@ interface Factory {
124123 * var v = rng();
125124 * // returns <bigint>
126125 */
127- ( options ?: Options ) : NullaryFunction ;
128- }
129-
126+ type Factory = ( options ?: Options ) => NullaryFunction ;
127+
130128/**
131129* Returns a xorshift128+ pseudorandom number generator.
132130*
@@ -162,9 +160,9 @@ interface Factory {
162160* // returns <bigint>
163161*/
164162declare var factory : Factory ;
165-
166-
163+
164+
167165// EXPORTS //
168-
166+
169167export = factory ;
170-
168+
0 commit comments