#include<iostream>
#include<vector>
#include<random>
int main()
{
std::vector<long long> vc(2, 0);
std::default_random_engine e;
// [1,10]之间的整数
std::uniform_int_distribution<long long> u(1, 10);
long long a = u(e);
vc[0] = a;
printf("vc[0]=%lld, a=%lld\n", vc[0],a);
printf("address_vc[0]=%p, address_a=%p", &vc[0], &a);
return 0;
}
c++生成随机整数
最新推荐文章于 2024-07-25 00:15:00 发布