(Go) 로또 번호 생성 package main import ( "fmt" "math/rand" "time" ) func main() { r := map[int]bool{} rand.Seed(time.Now().UnixNano()) for len(r) < 6 { r[rand.Intn(45)+1] = true } for x := range r { fmt.Println(x) } } My Computer Programs 2012.08.27
(Javascript) 로또 번호 생성 nums = []; r = []; while (r.length < 6) { n = Math.floor(Math.random() * 45 + 1); if (!nums[n]) { nums[n] = true; r.push(n); } } r.sort(function(a,b){return a-b}); document.writeln(r); Output: My Computer Programs 2012.08.27