Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.
Become a Premium Member and unlock a new, free course in leading technologies each month.
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;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
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
Join the community of 500,000 technology professionals and ask your questions.