Displaying 1 result from an estimated 1 matches for "lemarian".
Did you mean:
memarian
2010 Oct 05
3
R-help
Im trying to simulate the rolling of a pair of dice
this is my function:
#function to simulate tosses of a pair of dice
#from the simulation, the program returns the empirical probability of
#observing a double
count <- 0
for(j in 1:sim){#begin loop
die1 <- sample(1:6,1)
print(die1)
die2 <- sample(1:6,1)
print(die2)
count <- ifelse(die1 == die2, count + 1, count)
}#end loop
emprob