Comment detail

重複無し乱数 (Nested Flatten)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#module
#deffunc bingo int n
    dim dest, n
    repeat n
        dest.cnt = cnt+1
    loop
    repeat n
        r = rnd( n - cnt ) + cnt
        tmp = dest.r
        dest.r = dest.cnt
        dest.cnt = tmp
    loop
    buf = ""
    repeat n
        if ( cnt > 0 ) {
            buf += " "
        }
        buf += str( dest.cnt )
    loop
    mes buf
    return
#global
randomize
bingo 10
bingo 3
bingo 3
bingo 10

Index

Feed

Other

Link

Pathtraq

loading...