logo Practice-It logo

BJP4 Self-Check 5.5: randomRangeABCDE

Language/Type: Java basics Random
Author: Will Beebe (on 2016/09/08)

Consider the following code. What range of values can each variable (a, b, c, d, and e) have? Specify ranges with a dash i.e. "1 - 10" and separate multiple numbers with commas i.e. "1,2,3,4,5,etc..."

Random rand = new Random();
int a = rand.nextInt(100);
int b = rand.nextInt(20) + 50;
int c = rand.nextInt(20 + 50);
int d = rand.nextInt(100) - 20;
int e = rand.nextInt(10) * 4;

You must log in before you can solve this problem.

Log In

If you do not understand how to solve a problem or why your solution doesn't work, please contact your TA or instructor.
If something seems wrong with the site (errors, slow performance, incorrect problems/tests, etc.), please

Is there a problem? Contact a site administrator.