mt19937_64 get random numbers

#include <ctime>
#include <iostream>
#include <random>

using namespace std;

void uInt32Array(int len);

int main(int args, char** argv)
{ 
    uInt32Array(atoi(argv[1]));
}

void uInt32Array(int len)
{
    uint32_t* arr = new uint32_t[len];
    mt19937_64 mt(time(nullptr));
    for (int i = 0;i < len;i++)
    {
        arr[i] = mt();
    }

    for (int i = 0;i < len;i++)
    {
        cout << arr[i] << "\t";
    }
    cout << endl << endl;
    cout << "Finished in " << __FUNCTION__ << "," << __LINE__ << endl;
}

 

 

 

posted @ 2022-09-04 21:29  FredGrit  阅读(110)  评论(0编辑  收藏  举报