Difference between various numpy random functions

前端 未结 2 762
南方客
南方客 2021-02-01 14:32

The numpy.random module defines the following 4 functions that all seem to return a float betweeb [0, 1.0) from the continuous uniform distribution. What (if any) is the differe

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-01 15:29

    Nothing.

    They're just aliases to random_sample:

    In [660]: np.random.random
    Out[660]: 
    
    In [661]: np.random.ranf
    Out[661]: 
    
    In [662]: np.random.sample
    Out[662]: 
    
    In [663]: np.random.random_sample is np.random.random
    Out[663]: True
    
    In [664]: np.random.random_sample is np.random.ranf
    Out[664]: True
    
    In [665]: np.random.random_sample is np.random.sample
    Out[665]: True
    

提交回复
热议问题