JSPM

  • Created
  • Published
  • Downloads 966832
  • Score
    100M100P100Q190521F
  • License MIT

TypeScript definitions for seedrandom

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@types/seedrandom) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    Installation

    npm install --save @types/seedrandom

    Summary

    This package contains type definitions for seedrandom (https://github.com/davidbau/seedrandom).

    Details

    Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/seedrandom.

    index.d.ts

    // Type definitions for seedrandom 3.0
    // Project: https://github.com/davidbau/seedrandom
    // Definitions by: Kern Handa <https://github.com/kernhanda>
    //                 Eugene Zaretskiy <https://github.com/EugeneZ>
    //                 Martin Badin <https://github.com/martin-badin>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
    
    declare namespace seedrandom {
        type State = object;
    
        interface Callback {
            (prng?: PRNG, shortseed?: string, global?: boolean, state?: State): PRNG;
        }
    
        interface Options {
            entropy?: boolean | undefined;
            global?: boolean | undefined;
            pass?: Callback | undefined;
            state?: boolean | State | undefined;
        }
    
        interface PRNG {
            (): number;
            double(): number;
            int32(): number;
            quick(): number;
        }
    
        interface StatefulPRNG extends PRNG {
            state(): State;
        }
    }
    
    type ReturnedPRNG<O extends seedrandom.Options = {}> = O extends { state: true | seedrandom.State }
        ? seedrandom.StatefulPRNG
        : seedrandom.PRNG;
    
    interface BaseInterface {
        <O extends seedrandom.Options>(seed?: string, options?: O): ReturnedPRNG<O>;
        new (seed?: string): seedrandom.PRNG;
    }
    
    interface seedrandom {
        <O extends seedrandom.Options>(seed?: string, options?: O, callback?: seedrandom.Callback): ReturnedPRNG<O>;
        alea: BaseInterface;
        tychei: BaseInterface;
        xor128: BaseInterface;
        xor4096: BaseInterface;
        xorshift7: BaseInterface;
        xorwow: BaseInterface;
    }
    
    declare const seedrandom: seedrandom;
    
    export = seedrandom;
    

    Additional Details

    • Last updated: Fri, 30 Dec 2022 20:32:52 GMT
    • Dependencies: none
    • Global values: none

    Credits

    These definitions were written by Kern Handa, Eugene Zaretskiy, and Martin Badin.