Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.39 KB

File metadata and controls

39 lines (27 loc) · 1.39 KB

MCG31 brng

The 31-bit multiplicative congruential pseudo-random number generator mcg(1132489760, 2^{31} -1) can be initialized with either an integral seed, a list of integral seeds, or automatically.

    import mkl_random
    rs = mkl_random.RandomState(1234, brng="MCG31")

    # Use random state instance to generate 1000 random numbers from
    # Uniform(0, 1) distribution
    esample = rs.uniform(0, 1, size=1000)
    import mkl_random
    rs_vec = mkl_random.RandomState([1234, 567, 89, 0], brng="MCG31")

    # Use random state instance to generate 1000 random numbers from
    # Gamma(3, 1) distribution
    gsample = rs_vec.gamma(3, 1, size=1000)

When seed is not specified, the generator is initialized using system clock, e.g.:

    import mkl_random
    rs_def = mkl_random.RandomState(brng="MCG31")

    # Use random state instance to generate 1000 random numbers
    # from discrete uniform distribution [1, 6]
    isample = rs_def.randint(1, 6 + 1, size=1000)