scipy.stats seed?

后端 未结 4 962
滥情空心
滥情空心 2021-02-06 22:51

I am trying to generate scipy.stats.pareto.rvs(b, loc=0, scale=1, size=1) with different seed.

In numpy we can seed using numpy.random.seed(seed=233423).

Is ther

4条回答
  •  既然无缘
    2021-02-06 23:56

    scipy.stats just uses numpy.random to generate its random numbers, so numpy.random.seed() will work here as well. E.g.,

    import numpy as np
    from scipy.stats import pareto
    b = 0.9
    np.random.seed(seed=233423)
    print pareto.rvs(b, loc=0, scale=1, size=5)
    np.random.seed(seed=233423)
    print pareto.rvs(b, loc=0, scale=1, size=5)
    

    will print [ 9.7758784 10.78405752 4.19704602 1.19256849 1.02750628] twice.

提交回复
热议问题