C:\Users\notebook\Documents\NetBeansProjects\CS2\src\utilities\Random.java |
1
2
3
4 package utilities;
5
6 import java.awt.Color;
7 import java.awt.Point;
8
9
10
11 @author
12
13 public class Random {
14
15
16 static public Color color() {
17 int rv = (int)(Math.random()*256);
18 int gv = (int)(Math.random()*256);
19 int bv = (int)(Math.random()*256);
20 return new Color(rv,gv,bv);
21 }
22
23
24 public static Point point(int x, int y) {
25 int a = number(x);
26 int b = number(y);
27 return new Point(a,b);
28 }
29
30 private static int number(int x) {
31 return (int) Math.random()*x;
32 }
33
34 }
35