Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

c++ uniform_real_distribution get same result

//don't use a time based seed, you could use std::random_device like this:
// Create a random device and use it to generate a random seed
std::random_device myRandomDevice;
unsigned int seed = myRandomDevice(); //generate a random seed

std::uniform_real_distribution<double> dist(-1.0, 1.0); //will be from -1 to 1
double randomNumber = dist(seed); //now you get random numbers
Source by www.gormanalysis.com #
 
PREVIOUS NEXT
Tagged: #result
ADD COMMENT
Topic
Name
4+8 =