What value(s) will be output by the following Java code statements?
System.out.println( (int)(Math.random()*5) + 3 ); _________________
System.out.println( (int)Math.random()*4 + 5 ); _________________
System.out.println( (int)(Math.random()*50) );
1
Expert's answer
2020-04-27T01:57:09-0400
System.out.println( (int)(Math.random()*5) + 3 ); // int from 3 to 8
System.out.println( (int)Math.random()*4 + 5 ); //always int 5
System.out.println( (int)(Math.random()*50) ); // int from 0 to 50
Comments
Leave a comment