java - Trying to create a random number generator with user input for parameters -
whenever attempt this, weird numbers. if input 10, 1.012....... , if input 8 64359... import java.util.scanner; import java.util.random;
class proyecto{ public static void main(string[]args){ scanner input = new scanner(system.in); random numb = new random(); int numbe; int number; numbe = input.nextint(); numbe = numb.nextint(); system.out.println(numb.nextint()); } }
here rewrite class.
import java.util.random; class proyecto{ public static void main(string[]args){ random numb = new random(); if(args.length>0){ system.out.println(numb.nextint(integer.parseint(args[0].tostring())); } } }
Comments
Post a Comment