+ 1

How we can create random function with using built-in rand() function..??

24th Aug 2019, 5:41 AM
Vaidehi Chotaliya
Vaidehi Chotaliya - avatar
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.
24th Aug 2019, 5:48 AM
Sonic
Sonic - avatar
+ 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.
24th Aug 2019, 5:47 AM
Manual
Manual - avatar
+ 2
you can use it with switch or function pointer to call a random function if that's what you want
24th Aug 2019, 9:23 AM
✳AsterisK✳
✳AsterisK✳ - avatar
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
24th Aug 2019, 9:29 AM
zemiak