Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- allwomen <- rep(0,1000000) # one million un-raped women
- rapes <- 250000 # 250,000 rapes
- for (i in 1:rapes){
- victim <- round(runif (1,0,length(allwomen))) # Pick a victim at random
- allwomen[victim] <- allwomen[victim] + 1 # record the rape
- }
- hist(allwomen) # plot a graph of the rape distribution
- length(allwomen[allwomen==0]) # How many women are un-raped
- length(allwomen[allwomen>=1]) # How many are raped
- length(allwomen[allwomen>=1])/1000000 # percentage of rape victims
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement