All pastes #774054 Raw Edit

PRNG_Gen

public java v1 · immutable
·published 2007-11-14 22:59 UTC
rendered paste body
/** ENTER YOUR CODE IN THIS CLASS * *//* * here be the generating class * it's funny, i would have thought it'd be a lot longer than this  * * Given max (m) and min (n), min inclusive, max exclusive */public class mainApp {	int min; // minimum number that can be generated.	int max; // maximum number that can be generated.	int value;	int number;	public mainApp(int n, int m) {		max = m;		min = n;	}	public int getRandom() {		long rawseed = System.currentTimeMillis();		int seed = (int)rawseed;//		System.out.println("Primary seed: " + seed);		number = seed/2 - seed/4;		while ((number < 1) || (number > 20)) {			if (number < 1) {				number = number + 20;			}			if (number > 20) {				number = number - 20;;			}		}                //note here: i tried replacing 1 and 20                // with min and max, respectively.                // for some reason, any value in "min" other                // than 1 stalled the program at around                // 10 iterations. however, i haven't tested                // in eclipse yet (used a different IDE today                // because i was a dip and forgot the USB cable)		value = number;		return value;	}}