Code example for Random

Methods: nextLong

0
	 * @return the name of the temp file. 
	 */ 
	public static String getTempFile(String prefix, String suffix) {
		Time now = new Time();
		now.setToNow();
		Random rnd = new Random(now.toMillis(false));
		Long val = now.toMillis(false) + rnd.nextLong();
		String filename = Long.toHexString(val);
		filename = prefix + filename + suffix;
		return filename;
	} 
 
	/** 
	 * Get a temporary filename using Time + Random. The prefix and 
	 * suffix for this temp file will be "" and ".temp" respectively. 
	 * @return the name of the temp file. 
	 */ 
	public static String getTempFile() {
		return getTempFile("", ".temp"); 
	}