vendredi 27 novembre 2020

how to obtain c++ chrono microseconds based on double instead of integer [duplicate]

in the following code the Random::get() is a function that returns a random number in range [0, 1). The compiler screams on third line that integer is required. How to make it accepting a double?

double const timeFluctuationAmplitudeMicroseconds = 5000;
double timeFluctuationMicroseconds = timeFluctuationAmplitudeMicroseconds * Random::get();
auto abc = std::chrono::milliseconds(timeFluctuationMicroseconds);

Aucun commentaire:

Enregistrer un commentaire