You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1021 B

mt19937 是啥玩意?

懵逼树上懵逼果,懵逼树下只有我

简介 mt是指maxint(整型int最大值的缩写) 19937是指2^{19937}-1

mt19937c++11新特性,它是一种随机数算法,用法与rand()函数类似,但是mt19937具有速度快,周期长的特点(所谓周期长应该是指19937所代表的意思吧),rand()windows下生成的数据范围为0-32726,此时的mt19937所生成的数据范围大概为 (-maxint,+maxint)(maxint整型int最大值的缩写)

总结 这玩意要想生成特别多的随机数,碰撞小,就使这个,能顶到int的整个区间不重复。 如果不使,只能有32726个随机数。

还是使上好,要不,给你多点数据,就完蛋了,树就不平衡了,就O(N)了!

#include <bits/stdc++.h>
using namespace std;

//更牛B的随机数生成器
mt19937 rnd(time(0));

int main() {
    printf("%lld\n", rnd());
    return 0;
}