I need to generate 8 random integers, but they need to be unique, aka not repeated.
For example, I want 8 numbers within the range 1 to 8.
I\'ve seen arc4ran
Uniqueness is something that you need to provide-- randomness APIs won't do this for you.
As has been suggested, you can generate a number and then check to see whether it collides with something you've already generated, and if so, try agin. Please note however, that depending on the quantity of numbers and the size of the range, this becomes an algorithm that doesn't have a guaranteed end point.
If you're really just trying to get a contiguous set of numbers in random order, this is a not the way to do it, since it could take an unpredictably long time to complete. In this case, building an array of all desired values first, and then "shuffling" the array is a better choice. The best shuffle is the Fisher-Yates, but if you don't need it to be perfectly unbiased, you could also do what's described here.