Groovy web console

subscribe to the feed Subscribe
to this
site

Nd3

Published 2 months ago by Daniel with tags die
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def dadoDeTres() {
    Random rnd = new Random()
    return rnd.next(2)
}

def nDadosDeTres(numDados) {
    i=0
    total=0

    while(i<=numDados) {
        total+=dadoDeTres()
        i++
    }
    return total
}

println(nDadosDeTres(4))