numpy.random.bytes#

random.bytes(length)#

返回随机字节。

注意

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

参数:
lengthint

随机字节数。

返回:
outbytes

长度为 length 的字符串。

另请参阅

random.Generator.bytes

应在新代码中使用。

示例

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