使用 random_indices = random.sample(range(num_nodes), 5)
报错:ValueError: Sample larger than population or is negative
原因:当random.sample()中的第二个参数大于列表population的元素个数,就会报错。
可以使用numpy的choice方法。
Sample larger than population or is negative
最新推荐文章于 2024-07-10 16:50:08 发布