Merge pull request #264 from weibk/patch-1

update python randomAccess
This commit is contained in:
Yudong Jin 2023-01-17 02:04:44 +08:00 committed by GitHub
commit 5b99d8b4f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -137,7 +137,7 @@ elementAddr = firtstElementAddr + elementLength * elementIndex
""" 随机访问元素 """
def randomAccess(nums):
# 在区间 [0, len(nums)) 中随机抽取一个数字
random_index = random.randint(0, len(nums))
random_index = random.randint(0, len(nums)-1)
# 获取并返回随机元素
random_num = nums[random_index]
return random_num