Something like
int *a = new int(10)
Int*b = null
While *b !=10 { b = rand(); a=new int(10)}
Return *b
I haven't coded recently enough in c/c++ to remember syntax but the concept might work eventually if you're lucky and have enough memory... Might need a time variant seed on the rand()...