********************************************************************** 1. Random method of Math class: Raju Rohde + p.81-83 -- using Random class, need objects p.203-205 -- using Math class, no objects + Math.random() returns a random floating point number between 0.0 (inclusive) and 1.0 (exclusive). Notation: [0,1). + SYNTAX: float num1 = Math.random(); + Need to SCALE and SHIFT into an appropriate range + Need CASTing (p.73) to produce Integer random numbers + SCALE: float rnd = Math.random()*10; // num1=[0.0,10.0) + SHIFT: float rnd = Math.random()+2; // num1=[2.0,3.0) + CAST: int rnd = (int) (Math.random()*N); // num1=0,1,...,N-1 + EXAMPLES: (1) produce a float random number in the range [1.0,6.0): float rnd = Math.random()*5 + 1; (2) produce an int random number 0 or 1: int rnd = (int) (Math.random()*2); (3) produce an int random number 1, 2, 3, or 4: int rnd = (int) (Math.random()*4) + 1; (4) what is the range of the random number determined with this statement: int rnd = (int) Math.random()*4 + 1; **********************************************************************