我发现了一个很奇怪的现象
  • 板块灌水区
  • 楼主YCSluogu
  • 当前回复5
  • 已保存回复5
  • 发布时间2022/7/23 20:49
  • 上次更新2023/10/27 18:43:48
查看原帖
我发现了一个很奇怪的现象
311721
YCSluogu楼主2022/7/23 20:49
random_device seed;
mt19937_64 e(clock());
template<class type>
type rand(type down, type up) {
  uniform_int_distribution<type> rand(down, up);
  return rand(e);
}

srand(seed());
int t = rand(5, 10);
for (int i = 1; i <= t; i++) {
  int a = rand(1, n);
  int b = rand(a, n);
  random_shuffle(s + a, s + 1 + n);
  random_shuffle(s + b, s + 1 + n);
}

有这样一段代码,但是我莫名发现s在这么一顿乱转之后转成原来的样子概率极高(>80%)。系统环境是 linux

2022/7/23 20:49
加载中...