Random values for a Java exercise

Asked

Viewed 35 times

-2

I’m wanting to make a sum exercise application, it should do a search in the database where will be registered the 3 values(val1, val2, rest) as I make this search in the bank be random???

  • Welcome to Stack Overflow! Your question seems to have some problems and your experience here in Stack Overflow may not be the best because of this. We want you to do well here and get what you want, but for that we need you to do your part. Here are some guidelines that will help you: Stack Overflow Survival Guide in English (short version). If the help is very simple it is still possible to do in the comments.

1 answer

-2


If you are using numbers as Primary key, you can use java.util.Random#nextInt(int) to generate a random number and do a database search based on that number that nextInt(3) returned.

  • I think in his case, he’ll have to retrieve the database data, generate this random number and retrieve the list index corresponding to the random number

  • i tested java.util.Random#nextInt(int) but I will save operations like 1+1 = 2 and send these values to the program and I want these data to be searched randomly in the database

Browser other questions tagged

You are not signed in. Login or sign up in order to post.