+ 3
random sequence
rand() in other words called as in c# and Java
2 Respuestas
+ 3
int max , min;
in c#
Random r = new Random ();
r.next(min,max);
or simply
r.next();
for java
one way
import java.util.Random;
Random rand = new Random();
int n = rand.nextInt(max) + min;
another way
int random = (int )(Math.random() * 50 + 1);
to select between 50 and 1
+ 7
Yes. But rand() isn't the best for c++. Try using random generation functionality found in the header file <random>
Here is some examples of its usage.
https://code.sololearn.com/cd91tzFJGYO7/?ref=app
https://code.sololearn.com/cZtmt5Apo0tf/?ref=app