numpy.random.bytes#

random.bytes(length)#

返回随机字节.

备注

新代码应该使用 bytes 方法,该方法是 Generator 实例的一个方法;请参阅 快速入门 .

参数:
lengthint

随机字节数.

返回:
outbytes

长度为 length 的字符串.

参见

random.Generator.bytes

新代码应该使用这个.

示例

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