Why do I keep getting the same first number while I've seeded a generator with time?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
13
down vote

favorite
2












I don't understand why I keep getting the same 1st number when I've already seeded a default_random_engine with time(0)(C++ Primer tell me to usetime(0)). Is it a problem of my computer? (Ubuntu, C++11)



I tried on a online compiler and it's interesting that I got the same 1st number using gcc while not using clang++.



https://wandbox.org/permlink/kiUg1BW1RkDL8y8c



Code:



#include <iostream>
#include <ctime>
#include <random>
using namespace std;
int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
uniform_int_distribution<int> uniform_dist(0, 9);
cout << "sequence:";
for(int i = 0; i < 10; i++)
cout << uniform_dist(e);

cout << endl;
return 0;



Result:



As you can see I keep getting 6 as the first random number, no matter I use clang++ or g++ to compile.
enter image description here










share|improve this question



















  • 4




    That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
    – Some programmer dude
    54 mins ago






  • 1




    @Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
    – Rick
    41 mins ago






  • 3




    Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
    – Blastfurnace
    38 mins ago






  • 1




    If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
    – NathanOliver
    35 mins ago







  • 2




    It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
    – Blastfurnace
    19 mins ago















up vote
13
down vote

favorite
2












I don't understand why I keep getting the same 1st number when I've already seeded a default_random_engine with time(0)(C++ Primer tell me to usetime(0)). Is it a problem of my computer? (Ubuntu, C++11)



I tried on a online compiler and it's interesting that I got the same 1st number using gcc while not using clang++.



https://wandbox.org/permlink/kiUg1BW1RkDL8y8c



Code:



#include <iostream>
#include <ctime>
#include <random>
using namespace std;
int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
uniform_int_distribution<int> uniform_dist(0, 9);
cout << "sequence:";
for(int i = 0; i < 10; i++)
cout << uniform_dist(e);

cout << endl;
return 0;



Result:



As you can see I keep getting 6 as the first random number, no matter I use clang++ or g++ to compile.
enter image description here










share|improve this question



















  • 4




    That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
    – Some programmer dude
    54 mins ago






  • 1




    @Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
    – Rick
    41 mins ago






  • 3




    Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
    – Blastfurnace
    38 mins ago






  • 1




    If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
    – NathanOliver
    35 mins ago







  • 2




    It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
    – Blastfurnace
    19 mins ago













up vote
13
down vote

favorite
2









up vote
13
down vote

favorite
2






2





I don't understand why I keep getting the same 1st number when I've already seeded a default_random_engine with time(0)(C++ Primer tell me to usetime(0)). Is it a problem of my computer? (Ubuntu, C++11)



I tried on a online compiler and it's interesting that I got the same 1st number using gcc while not using clang++.



https://wandbox.org/permlink/kiUg1BW1RkDL8y8c



Code:



#include <iostream>
#include <ctime>
#include <random>
using namespace std;
int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
uniform_int_distribution<int> uniform_dist(0, 9);
cout << "sequence:";
for(int i = 0; i < 10; i++)
cout << uniform_dist(e);

cout << endl;
return 0;



Result:



As you can see I keep getting 6 as the first random number, no matter I use clang++ or g++ to compile.
enter image description here










share|improve this question















I don't understand why I keep getting the same 1st number when I've already seeded a default_random_engine with time(0)(C++ Primer tell me to usetime(0)). Is it a problem of my computer? (Ubuntu, C++11)



I tried on a online compiler and it's interesting that I got the same 1st number using gcc while not using clang++.



https://wandbox.org/permlink/kiUg1BW1RkDL8y8c



Code:



#include <iostream>
#include <ctime>
#include <random>
using namespace std;
int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
uniform_int_distribution<int> uniform_dist(0, 9);
cout << "sequence:";
for(int i = 0; i < 10; i++)
cout << uniform_dist(e);

cout << endl;
return 0;



Result:



As you can see I keep getting 6 as the first random number, no matter I use clang++ or g++ to compile.
enter image description here







c++






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 9 mins ago









Yakk - Adam Nevraumont

175k19179360




175k19179360










asked 1 hour ago









Rick

1,589825




1,589825







  • 4




    That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
    – Some programmer dude
    54 mins ago






  • 1




    @Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
    – Rick
    41 mins ago






  • 3




    Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
    – Blastfurnace
    38 mins ago






  • 1




    If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
    – NathanOliver
    35 mins ago







  • 2




    It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
    – Blastfurnace
    19 mins ago













  • 4




    That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
    – Some programmer dude
    54 mins ago






  • 1




    @Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
    – Rick
    41 mins ago






  • 3




    Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
    – Blastfurnace
    38 mins ago






  • 1




    If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
    – NathanOliver
    35 mins ago







  • 2




    It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
    – Blastfurnace
    19 mins ago








4




4




That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
– Some programmer dude
54 mins ago




That's one of the problems with random number generators, especially with such a limited set of numbers to choose from. You could probably improve it by using a better engine (like mt19937). I also suggest you see the example in this uniform_int_distribution reference.
– Some programmer dude
54 mins ago




1




1




@Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
– Rick
41 mins ago




@Someprogrammerdude Hmm. I tried 2 combinations. 1. Enlarge (0, 9) to (0, 10000) don't change anything. 2. Replace time(0) with random_device, it works. Interesting.
– Rick
41 mins ago




3




3




Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
– Blastfurnace
38 mins ago




Using time(0) the seed values aren't that different, unlike using std::random_device. If you still wanted to use time(0) you could call e.discard(n); where n is the number of steps you want to advance the generator's state. If effect, throwing away the initial n values.
– Blastfurnace
38 mins ago




1




1




If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
– NathanOliver
35 mins ago





If std::default_random_engine is implemented as rand, then time(0) is not going to produce vastly different seeds which will lead to a random sequence that is close the the last one. Stay away from std::default_random_engine as you don't know what it is. Unless you really need performance I would default to using a std::mt19937 as your go to PRNG
– NathanOliver
35 mins ago





2




2




It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
– Blastfurnace
19 mins ago





It really depends on the generator. It's conceivable that the most-significant bits of the seed have a greater effect on the generator's initial state. My advice, use a better seed like std::random_device and maybe use discard() to "warm up" the generator before use.
– Blastfurnace
19 mins ago













1 Answer
1






active

oldest

votes

















up vote
9
down vote



accepted










You are setting initial states into your random-generator that are very similar. Depending on the quality of the generator, this may or may not result in similar outputs. To illustrate, I've augmented your sample to (a) print only the first sequence, since that is what we care about, and (b) print several results of various resolution:



int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
default_random_engine e2(t);
default_random_engine e3(t);
default_random_engine e4(t);
uniform_int_distribution<int> uniform_dist(0, 9);
uniform_int_distribution<int> uniform_dist2(0,999);
uniform_int_distribution<int> uniform_dist3(0,99999);
uniform_int_distribution<int> uniform_dist4(0,9999999);
cout << "sequence: ";
cout << uniform_dist(e) << " " << uniform_dist2(e2) << " " << uniform_dist3(e3) << " " << uniform_dist4(e4);
cout << endl;
return 0;



When run:



$ ./a.out
time: 1541162210
sequence: 7 704 70457 7070079
$ ./a.out
time: 1541162211
sequence: 7 704 70457 7070157
$ ./a.out
time: 1541162212
sequence: 7 704 70458 7070236
$ ./a.out
time: 1541162213
sequence: 7 704 70459 7070315
$ ./a.out
time: 1541162214
sequence: 7 704 70460 7070393
$ ./a.out
time: 1541162215
sequence: 7 704 70461 7070472
$ ./a.out
time: 1541162216
sequence: 7 704 70461 7070550
$ ./a.out
time: 1541162217
sequence: 7 704 70462 7070629
$ ./a.out
time: 1541162218
sequence: 7 704 70463 7070707
$ ./a.out
time: 1541162219
sequence: 7 704 70464 7070786


While I do not know exactly what this random-generator implementation is doing, you can easily see that it is performing a very simple transformation of your seed into state, and state into output values. As other comments have suggested, there are better random generators and better seeds. Also note that the quality varies between implementations; Visual Studio 2017 does not exhibit this behavior.






share|improve this answer




















  • Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
    – Rick
    11 mins ago










  • As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
    – jwimberley
    2 mins ago











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53118346%2fwhy-do-i-keep-getting-the-same-first-number-while-ive-seeded-a-generator-with-t%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
9
down vote



accepted










You are setting initial states into your random-generator that are very similar. Depending on the quality of the generator, this may or may not result in similar outputs. To illustrate, I've augmented your sample to (a) print only the first sequence, since that is what we care about, and (b) print several results of various resolution:



int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
default_random_engine e2(t);
default_random_engine e3(t);
default_random_engine e4(t);
uniform_int_distribution<int> uniform_dist(0, 9);
uniform_int_distribution<int> uniform_dist2(0,999);
uniform_int_distribution<int> uniform_dist3(0,99999);
uniform_int_distribution<int> uniform_dist4(0,9999999);
cout << "sequence: ";
cout << uniform_dist(e) << " " << uniform_dist2(e2) << " " << uniform_dist3(e3) << " " << uniform_dist4(e4);
cout << endl;
return 0;



When run:



$ ./a.out
time: 1541162210
sequence: 7 704 70457 7070079
$ ./a.out
time: 1541162211
sequence: 7 704 70457 7070157
$ ./a.out
time: 1541162212
sequence: 7 704 70458 7070236
$ ./a.out
time: 1541162213
sequence: 7 704 70459 7070315
$ ./a.out
time: 1541162214
sequence: 7 704 70460 7070393
$ ./a.out
time: 1541162215
sequence: 7 704 70461 7070472
$ ./a.out
time: 1541162216
sequence: 7 704 70461 7070550
$ ./a.out
time: 1541162217
sequence: 7 704 70462 7070629
$ ./a.out
time: 1541162218
sequence: 7 704 70463 7070707
$ ./a.out
time: 1541162219
sequence: 7 704 70464 7070786


While I do not know exactly what this random-generator implementation is doing, you can easily see that it is performing a very simple transformation of your seed into state, and state into output values. As other comments have suggested, there are better random generators and better seeds. Also note that the quality varies between implementations; Visual Studio 2017 does not exhibit this behavior.






share|improve this answer




















  • Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
    – Rick
    11 mins ago










  • As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
    – jwimberley
    2 mins ago















up vote
9
down vote



accepted










You are setting initial states into your random-generator that are very similar. Depending on the quality of the generator, this may or may not result in similar outputs. To illustrate, I've augmented your sample to (a) print only the first sequence, since that is what we care about, and (b) print several results of various resolution:



int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
default_random_engine e2(t);
default_random_engine e3(t);
default_random_engine e4(t);
uniform_int_distribution<int> uniform_dist(0, 9);
uniform_int_distribution<int> uniform_dist2(0,999);
uniform_int_distribution<int> uniform_dist3(0,99999);
uniform_int_distribution<int> uniform_dist4(0,9999999);
cout << "sequence: ";
cout << uniform_dist(e) << " " << uniform_dist2(e2) << " " << uniform_dist3(e3) << " " << uniform_dist4(e4);
cout << endl;
return 0;



When run:



$ ./a.out
time: 1541162210
sequence: 7 704 70457 7070079
$ ./a.out
time: 1541162211
sequence: 7 704 70457 7070157
$ ./a.out
time: 1541162212
sequence: 7 704 70458 7070236
$ ./a.out
time: 1541162213
sequence: 7 704 70459 7070315
$ ./a.out
time: 1541162214
sequence: 7 704 70460 7070393
$ ./a.out
time: 1541162215
sequence: 7 704 70461 7070472
$ ./a.out
time: 1541162216
sequence: 7 704 70461 7070550
$ ./a.out
time: 1541162217
sequence: 7 704 70462 7070629
$ ./a.out
time: 1541162218
sequence: 7 704 70463 7070707
$ ./a.out
time: 1541162219
sequence: 7 704 70464 7070786


While I do not know exactly what this random-generator implementation is doing, you can easily see that it is performing a very simple transformation of your seed into state, and state into output values. As other comments have suggested, there are better random generators and better seeds. Also note that the quality varies between implementations; Visual Studio 2017 does not exhibit this behavior.






share|improve this answer




















  • Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
    – Rick
    11 mins ago










  • As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
    – jwimberley
    2 mins ago













up vote
9
down vote



accepted







up vote
9
down vote



accepted






You are setting initial states into your random-generator that are very similar. Depending on the quality of the generator, this may or may not result in similar outputs. To illustrate, I've augmented your sample to (a) print only the first sequence, since that is what we care about, and (b) print several results of various resolution:



int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
default_random_engine e2(t);
default_random_engine e3(t);
default_random_engine e4(t);
uniform_int_distribution<int> uniform_dist(0, 9);
uniform_int_distribution<int> uniform_dist2(0,999);
uniform_int_distribution<int> uniform_dist3(0,99999);
uniform_int_distribution<int> uniform_dist4(0,9999999);
cout << "sequence: ";
cout << uniform_dist(e) << " " << uniform_dist2(e2) << " " << uniform_dist3(e3) << " " << uniform_dist4(e4);
cout << endl;
return 0;



When run:



$ ./a.out
time: 1541162210
sequence: 7 704 70457 7070079
$ ./a.out
time: 1541162211
sequence: 7 704 70457 7070157
$ ./a.out
time: 1541162212
sequence: 7 704 70458 7070236
$ ./a.out
time: 1541162213
sequence: 7 704 70459 7070315
$ ./a.out
time: 1541162214
sequence: 7 704 70460 7070393
$ ./a.out
time: 1541162215
sequence: 7 704 70461 7070472
$ ./a.out
time: 1541162216
sequence: 7 704 70461 7070550
$ ./a.out
time: 1541162217
sequence: 7 704 70462 7070629
$ ./a.out
time: 1541162218
sequence: 7 704 70463 7070707
$ ./a.out
time: 1541162219
sequence: 7 704 70464 7070786


While I do not know exactly what this random-generator implementation is doing, you can easily see that it is performing a very simple transformation of your seed into state, and state into output values. As other comments have suggested, there are better random generators and better seeds. Also note that the quality varies between implementations; Visual Studio 2017 does not exhibit this behavior.






share|improve this answer












You are setting initial states into your random-generator that are very similar. Depending on the quality of the generator, this may or may not result in similar outputs. To illustrate, I've augmented your sample to (a) print only the first sequence, since that is what we care about, and (b) print several results of various resolution:



int main()
auto t = time(0);
cout << "time: " << t << endl;
default_random_engine e(t);
default_random_engine e2(t);
default_random_engine e3(t);
default_random_engine e4(t);
uniform_int_distribution<int> uniform_dist(0, 9);
uniform_int_distribution<int> uniform_dist2(0,999);
uniform_int_distribution<int> uniform_dist3(0,99999);
uniform_int_distribution<int> uniform_dist4(0,9999999);
cout << "sequence: ";
cout << uniform_dist(e) << " " << uniform_dist2(e2) << " " << uniform_dist3(e3) << " " << uniform_dist4(e4);
cout << endl;
return 0;



When run:



$ ./a.out
time: 1541162210
sequence: 7 704 70457 7070079
$ ./a.out
time: 1541162211
sequence: 7 704 70457 7070157
$ ./a.out
time: 1541162212
sequence: 7 704 70458 7070236
$ ./a.out
time: 1541162213
sequence: 7 704 70459 7070315
$ ./a.out
time: 1541162214
sequence: 7 704 70460 7070393
$ ./a.out
time: 1541162215
sequence: 7 704 70461 7070472
$ ./a.out
time: 1541162216
sequence: 7 704 70461 7070550
$ ./a.out
time: 1541162217
sequence: 7 704 70462 7070629
$ ./a.out
time: 1541162218
sequence: 7 704 70463 7070707
$ ./a.out
time: 1541162219
sequence: 7 704 70464 7070786


While I do not know exactly what this random-generator implementation is doing, you can easily see that it is performing a very simple transformation of your seed into state, and state into output values. As other comments have suggested, there are better random generators and better seeds. Also note that the quality varies between implementations; Visual Studio 2017 does not exhibit this behavior.







share|improve this answer












share|improve this answer



share|improve this answer










answered 26 mins ago









Wheezil

1,6191826




1,6191826











  • Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
    – Rick
    11 mins ago










  • As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
    – jwimberley
    2 mins ago

















  • Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
    – Rick
    11 mins ago










  • As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
    – jwimberley
    2 mins ago
















Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
– Rick
11 mins ago




Dude, this experiment is so smart and straightforward. Very comprehensive, thanks.
– Rick
11 mins ago












As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
– jwimberley
2 mins ago





As a slight improvement, time(0) could be fed into std::mt19937 (EDIT: I now see that pretty much everyone else has already recommended this).
– jwimberley
2 mins ago


















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53118346%2fwhy-do-i-keep-getting-the-same-first-number-while-ive-seeded-a-generator-with-t%23new-answer', 'question_page');

);

Post as a guest













































































Comments

Popular posts from this blog

Long meetings (6-7 hours a day): Being “babysat” by supervisor

Is the Concept of Multiple Fantasy Races Scientifically Flawed? [closed]

Confectionery