MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.
Random r = new Random();
int first = r.nextInt(9) + 1;
int second = r.nextInt(9) + 1;
while (second < first){
second = r.nextInt(9);
}
//answer
sum = first - second;
Random r = new Random();
int first = r.nextInt(9) + 1;
int second = r.nextInt(9) + 1;
if ( first < second )
{
int temp = first;
first=second;
second=temp;
}
//answer
sum = first - second;
sum /*[sic]*/ = Math.max(first,second)>second?first-second:second-first;
int first = r.nextInt(9) + 1;
int second = r.nextInt(Math.max(first - 1, 1)) + 1;
My whole point all along has been that first should ALWAYS be <= second.
rather than just getting a positive answer from two unknown numbers, undisplayed numbers
second = (int)(Math.random()*10);
first = Math.max(Integer.rotateRight(second,255),0);
I've got no idea whether you are speaking from a child's point of view, the programmer, or someone else., as you mentioned the game was for a child, but you didn't seem to grasp that.
If you are experiencing a similar issue, please ask a related question
Title | # Comments | Views | Activity |
---|---|---|---|
windows explorer path to command prompt | 5 | 43 | |
HashTable highest marks enumeration alternative | 9 | 37 | |
java stored proc example | 9 | 29 | |
How to determine if a string is a valid SHA value | 7 | 28 |
Join the community of 500,000 technology professionals and ask your questions.
Connect with top rated Experts
10 Experts available now in Live!