使用random_shuffle生成随机序列,发现每次生成的都一样

看了下实现,里面用到了rand(), 想应该是随机种子的问题

加上 srand(static_cast<unsigned int>(time(0)));

OK

相关文章: