Groovy web console

subscribe to the feed Subscribe
to this
site

600 die rolls

Published 1 month ago by SophistiCat with tags probability
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def rnd = new Random()
def roll = { Math.abs(rnd.nextInt()) % 6 + 1 }
def n = 0
600.times {
    if (roll() == 1) n++
}
println n