View Javadoc

1   package com.jamesbryangraves.bob.util;
2   
3   import java.security.NoSuchAlgorithmException;
4   import java.security.SecureRandom;
5   import java.util.Random;
6   
7   public class BobUtils {
8   	
9   	public static int getRandomInt(int upperBound) {
10  		try {
11  			Random random = SecureRandom.getInstance("SHA1PRNG");
12  			return random.nextInt(upperBound);
13  		} catch(NoSuchAlgorithmException nsae) {
14  			nsae.printStackTrace();
15  		}
16  		return -1;
17  	}
18  
19  }