Random int64 and float64 numbers

前端 未结 5 1166
失恋的感觉
失恋的感觉 2021-02-14 19:07

I\'m trying to generate random 64-bit integer values for integers and floats using Numpy, within the entire range of valid values for that type. To generate ran

5条回答
  •  不知归路
    2021-02-14 19:23

    I realize this is a very old question, but there is a new answer in Python 3.6.3:

    Python 3.6.3 |Anaconda, Inc.| (default, Oct  6 2017, 12:04:38) 
    [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import numpy as np
    >>> import sys
    >>> sys.maxsize
    9223372036854775807
    >>> np.random.randint(sys.maxsize)
    8550528944245072046
    

提交回复
热议问题