But I find that each time the array I got are the same. |
That's because your using same (default) seed for 'generator'.
Either pass a seed to the constructor, or call the seed() method directly. e.g. (to seed using time)
std::default_random_engine generator(time(0));
or
1 2
|
default_random_engine generator;
generator.seed(time(0));
| |
Andy
Last edited on