别人的
import numpy as np import random as rd #method one def random_int_list(start, stop, length): start, stop = (int(start), int(stop)) if start <= stop else (int(stop), int(start)) length = int(abs(length)) if length else 0 random_list = [] for i in range(length): random_list.append(rd.uniform(start, stop)) return random_list cishu=100000 ksis=random_int_list(0,1,cishu) print(ksis[10]) #method two cishu=100000 ksis=np.random.rand(cishu) print(ksis[10])
参考:
1、hoooooolyhu《python生成随机数组》
时间: 2024-10-26 21:26:56