Visual Basic

Module Module1
    Sub Main()
        Dim x, i, y(48) As Integer
        For i = 0 To 48
            y(i) = 0
        Next

        For i = 1 To 6
            Randomize()
            x = Rnd() * 48
            If y(x) = 0 Then
                Console.Write(x + 1 & " ")
                y(x) = 1
            Else
                i = i - 1
            End If
        Next

        Console.ReadKey()
    End Sub
End Module

 

C#

okplaymayday 發表在 痞客邦 PIXNET 留言(0) 人氣()