+ 1
How we can create random function with using built-in rand() function..??
4 Respuestas
+ 5
Probably generate a random number between 0 and 10, convert it to integer and use it in switch statement to call up to 10 different functions. Not sure if this is what you mean.
+ 4
You need to elaborate in the description.
Remove the Java tag or the C tags.
The C/C++ rand() is different fron the java counterpart.
+ 2
you can use it with switch or function pointer to call a random function if that's what you want
0
you can generate random operators and number of members and join it to string, or calculate it
build-in random in java:
// way 1
import java.util.Random;
Random rand = new Random();
int n = rand.nextInt(max+1); // range 0..max
// way 2
n = (int) (Math.random() *(max+1)); // range 0..max
// other with
java.util.concurrent.ThreadLocalRandom;
java.security.SecureRandom