in reply to getting random number 8 times never the same

Over the years, I have found that there are three ways of looking at this problem, all three of which are appropriate in different situations:

  1. “Fuhgeddaboudit!”   Don’t borrow trouble.   If the domain of random numbers is big enough (such as, “a 32-bit integer”), and the pseudo-random number generator (PRNG) is good enough (it is...), then the possibility of getting the same number twice in a reasonable length of time is near-zero.   (If it were not so, then neither Monaco nor Las Vegas would still be full of casinos.)
  2. “Don’t worry about checking.”   If the domain is small, but the number-count that you actually need is also small, then the practical price to be paid by brute-force checking for dupes is also acceptably small.
  3. If the problem that you are dealing with, is approximately equal to “dealing from a deck of cards,” then ... do that.   Initialize an array of “all possible values,” then shuffle it and “deal cards” from it.   (As noted, you don’t have to invent your own card-shuffling algorithm.)