This is a classic "how do I achieve my solution?", rather than a
"here's my problem... how can I solve it" post...
Can we back up a second please?
What are you trying to achieve with this list of 500 numbers? And what
do you want to do if the list you have generated does contain
As already said, you can use the .uniq method to remove dupes - but
that might leave you with an array of 496 elements... would that be a
problem? Are you really asking "how do I generate an array of 500
What do you want to do with these 500 random numbers? Considering that
one user could make a request and get their 500 randoms, and another
user could do the same - there could be duplicates across users. Is
this going to be a problem?
Please try to ask clearer questions, as the way it stands, I could
spend ages of my time coming up with solutions to what I *think* is
your problem, just to have you say "nope... that's not what I was
after". Multiply that across the subscribers to this list, and you've
wasted a hell of a lot of peoples' time around the world :-/
PS BTW Why are you multiplying by 1 in your example code? (and does
that line even work if you paste it into your console, as it explodes
for me with a LocalJumpError... but that may just be Ruby versions...)