So I wrote a program that takes a deck of cards of a given size and pulls a random one using this code
The problem is, I have it in a loop so I can pull multiple cards. I don't want to pull the same card twice so there is a nested loop inside to go through an array of pulled cards to find if that card as already been pulled. I started keeping track of how many "duplicate" draws the program finds and it seems to be what is stopping my program from working. I set the program to just shut down after getting 10,000 duplicate draws.
It seems to be related to the number of cards drawn relative to the size of the deck. I cant pull more that 10 cards out of a 60 card deck for example. I think it may have something to do with the seed and creating many random numbers at once. How do I solve this problem.
Code:
card = CInt(Int((deck * Rnd()) + 1))It seems to be related to the number of cards drawn relative to the size of the deck. I cant pull more that 10 cards out of a 60 card deck for example. I think it may have something to do with the seed and creating many random numbers at once. How do I solve this problem.