I have an issue ,trying to build a unique number generator.
Specifiacally, the generator is this
                Random randomPerson=new Random(System.nanoTime());
		int no_persons=persons.length;
		int cnt=0;
		while(cnt<70) {
			int person=randomPerson.nextInt(no_persons);
			if(function()) {
function() returns a boolean whether the random number hasn't used before (and some other operations eg insertion to an array)
When this program is executed, I either take the aprropriate output, or the program stucks (infinite loop). Is there any possibility to fix this infinite loop?

Thanks in advace!