Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rivit = 100000
- lottonumerot <- data.frame(x1=rep(0, rivit),x2=rep(0, rivit),x3=rep(0, rivit),x4=rep(0, rivit),x5=rep(0, rivit),x6=rep(0, rivit),x7=rep(0, rivit))
- for (i in 1:rivit){
- arvottu_rivi = sort(sample(1:40, 7, replace=FALSE))
- #print(arvottu_rivi)
- lottonumerot[i,] = rbind(arvottu_rivi)
- }
- oikea_rivi = sort(sample(1:40, 7, replace=FALSE)) #[1] 11 12 16 23 29 33 39
- print(oikea_rivi)
- #View(lottonumerot)
- voitot = 0
- for (i in 1:rivit){
- if (all(lottonumerot[i,] == oikea_rivi))
- voitot = voitot +1
- }
- voittoprosentti = round((voitot/rivit)*100, digits = 2)
- paste("Rivien määrä: ", rivit)
- paste(voitot ,"voittoa,","voittoprosentti",voittoprosentti ,"%" )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement