Hint 3 on random numbers for Lab 2 (Fall 2024)

Here is program that will print a random integer between 0 and 10:
import java.io.*;
import java.util.*;
public class RandomDemo {
    public static void main(String[] args) {
        Random generator;
        int number;

        generator = new Random();
        number generator.nextInt(10);
        System.out.println(number);
    }
}
Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions...
Topic revision: r1 - 2024-06-04 - CathyBareiss
 
  • Edit
  • Attach
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2026 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback