I made a random simulation of Roulette
set.seed(101)
n=10000
black <- sample("black",size=n, replace=TRUE)
red <- sample("red",size=n, replace=TRUE)
green <- sample("green",size=n, replace=TRUE)
roulette_table=matrix(NaN,n,1)
for (i in 1:n) {
temp = runif(1, 0, 1) # uniform between 0 and 1
# determines the probability
if (temp<0.04) {
roulette_table [i,1]=green[i]
} else if (temp>0.04 & temp<0.52) {
roulette_table[i,1]=red[i]
} else {
roulette_table[i,1]=black[i]
}
}
How can i count the frequency of repeating characters ? Thanks
Aucun commentaire:
Enregistrer un commentaire