另一种方式是把包含整数0~n-1的数组顺序打乱,然后把前m个元素排序输出:
for i in range(0, m): swap(i, randint(i, n-1))
posted on 2015-03-07 05:33 HuamuXie 阅读(150) 评论(0) 收藏 举报