-1
$\begingroup$

I have a specific task in programming but I am curious about how long it will take to complete.

I have an array "A" with 1000 unique numbers inside.

For each iteration I am copying 30 randomly picked numbers from array "A" to array "B".

Duplicate numbers(which already exists in array "B") are not copied

Question is: how many iterations do I need to claim with a certain probability, that all numbers are copied from "A" to "B"

Thanks

$\endgroup$
6
  • $\begingroup$ do you pick 30 numbers randomly? $\endgroup$
    – Aksakal
    Commented Aug 12, 2015 at 18:37
  • $\begingroup$ yes, sorry I will add it to the question $\endgroup$
    – Oskar
    Commented Aug 12, 2015 at 18:37
  • $\begingroup$ is this a home work? you better show what you've done so far to solve the problem. it's an easy quiz type of question. $\endgroup$
    – Aksakal
    Commented Aug 12, 2015 at 18:39
  • $\begingroup$ No it's not a homework, that is why I have no idea of where to start to solve it. I have only conditions :) $\endgroup$
    – Oskar
    Commented Aug 12, 2015 at 18:41
  • $\begingroup$ I simplified the conditions, in reality each iteration takes about 2 minutes for now. I want to know how long it will take or how much I should decrease iteration duration $\endgroup$
    – Oskar
    Commented Aug 12, 2015 at 18:43

1 Answer 1

-1
$\begingroup$

One way to answer your question is to answer a similar question: what is the probability that any given number in A was not picked after $N$ iterations?

The answer to this question is: $P=(1-\frac{30}{1000})^N$

Then the answer to your original question is $\frac{\ln (1-p)}{\ln(1-\frac{30}{1000})}$, where $p=1-P$ is your certain probability.

Also, a word certain usually refers to probability 100% or 1. I'm assuming that you use this word in its different meaning, i.e. "specific but not explicitly named or stated".

$\endgroup$
1
  • 1
    $\begingroup$ This solution is not correct. For a correct solution, with references, please see the duplicate. $\endgroup$
    – whuber
    Commented Aug 12, 2015 at 19:53

Not the answer you're looking for? Browse other questions tagged or ask your own question.