Sort of working random number generator - needs to be tested