The picking itself is easy, but I’m having trouble making sure I can’t place the points on the same spot. I could of course re-random, but is there a better way? Thanks a lot!
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
choosing K indices from N possible locations randomly is equivalent to first random shuffling the array and then take the first K indices. If you program in c++ (which is what you are giving as tag), it can be as easy as:
first, make your 2D array flat, say its stored in a vector: vector elems;