Write statements that assign random integers to the variable n in the following ranges:

a) 1 £ n £ 2
b) 1 £ n £ 100
c) 0 £ n £ 9
d) 1000 £ n £ 1112
e) –1 £ n £ 1
f) –3 £ n £ 11


a) n = Math.floor( 1 + Math.random() * 2 );
b) n = Math.floor( 1 + Math.random() * 100 );
c) n = Math.floor( Math.random() * 10 );
d) n = Math.floor( 1000 + Math.random() * 113 );
e) n = Math.florr( -1 + Math.random() * 3 );
f) n = Math.floor( -3 + Math.random() * 15 );

Computer Science & Information Technology

You might also like to view...

The value in the middle of a sorted numerical sequence is known as the ____.

A. mode B. median C. average D. range

Computer Science & Information Technology

What is the virt-manager utility?

What will be an ideal response?

Computer Science & Information Technology

An RGB image has a minimum of four default color channels, plus the composite channel.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

The ____ tool adjusts the black-and-white points in an image.

a. Auto Color b. Auto Contrast c. Auto Tone d. Auto Correction

Computer Science & Information Technology