I am hitting Segmentation fault while in the below program. Compilation work fine.
#include <random>
#include <iostream>
int main()
{
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 19);
for (int n=0; n<10; ++n)
std::cout << dis(gen) << ' ';
std::cout << '\n';
}
Below is the error
Program terminated with signal 11, Segmentation fault.
#0 std::uniform_int_distribution<int>::operator()<std::mersenne_twister_engine<unsigned long, 32ul, 624ul, 397ul, 31ul, 2567483615ul, 11ul, 4294967295ul, 7ul, 2636928640ul, 15ul, 4022730752ul, 18ul, 1812433253ul> > (
this=0xb10f40, __urng=..., __param=...)
at /usr/include/c++/4.7/bits/random.tcc:864
864 uniform_int_distribution<_IntType>::
OS : Debian, gcc version 4.7.2
Let me know if need more information.
Aucun commentaire:
Enregistrer un commentaire