Groovy web console

subscribe to the feed Subscribe
to this
site
mega (via #groovywebconsole)
tweet this snippet Tweet
this
script

mega

Published 5 months ago by amadafoca
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
def random = new Random()
def array = (1..60).toList()

def number
def chosenNumbers = []

(1..6).each {
    number = random.nextInt(60)
    if (array.contains(number)) {
        chosenNumbers << number
        array.remove(array.indexOf(number))
    }
}

return chosenNumbers