c = [1,2,3,4]

[c[n] for n in np.random.randint(3,size = 5)]

3代表的是index的最大值,也就是c list的最大长度;

size = 5,意味着生成5个数据

更多推荐

随机数生成器python