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