I want to simulate Bernoulli process. I drop a coin N times by
initRand();
p = 0.5;
for ( int i=0; i<N; i++) {
x = rand();
if ( x < p ) success();
else failure();
}
Now two scenarios:
(i) At this point I continue to drop coin till 2*N:
for (; i<2*N; i++) {
x = rand();
if ( x < p ) success();
else failure();
}
(ii) here I restart random sequence and continue to drop till 2*N:
initRand();
for (; i<2*N; i++) {
x = rand();
if ( x < p ) success();
else failure();
}
In the first scenario, the probability of k successes over 2*N tosses is calculated as
P(success)=nchoosek(2*N,k)*p^k*(1-p)^(2*N-k)
Is the same correct for the second scenario? Or due to generator reset, we cannot think of the 2*N cycles as a single process?