numpy.random.RandomState.bytes#

方法

random.RandomState.bytes(length)#

Return random bytes.

備註

New code should use the bytes method of a Generator instance instead; please see the Quick start.

參數:
lengthint

Number of random bytes.

回傳值:
outbytes

String of length length.

也參考

random.Generator.bytes

which should be used for new code.

範例

>>> np.random.bytes(10)
b' eh\x85\x022SZ\xbf\xa4' #random