Just like in Java , (Math . random * ) statement is there a way to input array numbers in C++ ?
For example I want to input numbers from 6 to 89 with RANDOM numbers in C++. Assign them into arrays.
I know how to sort the numbers but I would just like to know the method to do random numbers to make my life easier.
I am rusty in programming and I am open to any criticism but I would appreciate a straightforward response.
Use
srandto seed the random number generator, then userandto get a random number.For example, the following program populates an array with rando values in your requested range:
This outputs (in my case):
Keep in mind that the properties of those random numbers may not be perfect due to the way they’re generated but, unless you’re a statistician or cryptographer, they should be fine.