Using <random> in code playground. Am I doing this right? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 10

Using <random> in code playground. Am I doing this right?

I have got the include <random> to work correctly in code playground! It now returns different random set of numbers each time it is run. Please let me know if this is the correct usage. Or if I am doing this incorrectly, can you point me in the right direction. Thanks All! https://code.sololearn.com/cV3QLcQ328I4/?ref=app

9th May 2017, 4:00 AM
jay
jay - avatar
1 Answer
+ 6
:) Thanks James. If you look at my previous attempts at using <random> in code playground you will see it returns the same set of random numbers each time the program is executed. https://code.sololearn.com/cd91tzFJGYO7/?ref=app My main question/s are: * Is the method I have used (using RDTSC) to generate a seed correct? * Are there any pitfalls (apart from the obvious compiler dependancy) in using this method. Sorry. I guess my question wasnt very clear.
9th May 2017, 4:24 AM
jay
jay - avatar