Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package test;
- public class Util {
- public static void sayMyName(String name) {
- System.out.println("My name is " + name);
- }
- public static void print(int i) {
- System.out.println(i);
- }
- public static void print(String str) {
- System.out.println(str);
- }
- public static int rand(int h) {
- int x = 0;
- x = (int)(Math.random() * ++h);
- return x;
- }
- /**
- * Return random value from L to H
- * @param l
- * @param h
- * @return
- */
- public static int rand( int l, int h) {
- int x = 0;
- x = (int)(Math.random() *(h - l) + l);
- return x;
- }
- public static int randV2( int start, int end) {
- int result = start +
- (int) (Math.random() * (end - start + 1));
- return result;
- }
- public static int randV3( int lowBound, int highBound) {
- int num = (int) ((Math.random() *
- (highBound - lowBound + 1)) + lowBound);
- return num;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement