hey guys i have a question about implimenting a random number method. i cant remember what i have to import for it. also i dont remember how to set the range. any help is much appreciated
Printable View
hey guys i have a question about implimenting a random number method. i cant remember what i have to import for it. also i dont remember how to set the range. any help is much appreciated
Hello big_c,
You need to import java.util.*;
You can generate a random number like this:
This code will print a random number between 0 - 100Code :import java.util.*; public class RandomNumber { public static void main(String[] args) { Random random = new Random(); int rand = random.nextInt(100); System.out.println(rand); } }
sweet deal. i really wish i didnt lose my book lol