VB Code:
  1. Option Explicit
  2.  
  3. Dim r As Byte, g As Byte, b As Byte, d(3) As Byte, flag As Byte
  4.  
  5. Private Sub Form_Load()
  6.     Randomize
  7.     r = 255: g = 255: b = 255: flag = 0
  8.  
  9. End Sub
  10.  
  11. Function Ran(ByVal a As Byte, ByVal c As Byte)
  12.    
  13.     If ((Rnd > 0.667 Or c = 0) And c < 255) Then
  14.         c = c + 1
  15.         d(a) = 2
  16.     ElseIf ((Rnd <= 0.5 Or c = 255) And c > 0) Then
  17.         c = c - 1
  18.         d(a) = 1
  19.     Else
  20.         d(a) = 0
  21.     End If
  22.  
  23.     Ran = c
  24.    
  25. End Function
  26.  
  27. Function DoIt(ByVal a As Byte, ByVal c As Byte)
  28.     If ((d(a) = 2 And c < 255) Or c = 0) Then
  29.         c = c + 1
  30.         d(a) = 2
  31.     Else
  32.         If ((d(a) = 1 And c) Or c = 255) Then
  33.             c = c - 1
  34.             d(a) = 1
  35.         End If
  36.        
  37.         If a = 3 Then
  38.             If (d(1) + d(2) + d(3) = 0) Then flag = 1
  39.         End If
  40.     End If
  41.  
  42.     DoIt = c
  43.  
  44. End Function
  45.  
  46. Function Disco()
  47.  
  48.     If flag Then
  49.         r = DoIt(1, r)
  50.         g = DoIt(2, g)
  51.         b = DoIt(3, b)
  52.         flag = flag - 1
  53.     Else
  54.         r = Ran(1, r)
  55.         g = Ran(2, g)
  56.         b = Ran(3, b)
  57.         flag = 50
  58.     End If
  59.    
  60.     Me.BackColor = RGB(r, g, b)
  61.  
  62. End Function
  63.  
  64. Private Sub Timer1_Timer()
  65. Disco
  66. End Sub

NOTE: This was converted from HTML, i think the link to its HTML source was www.wsabstract.com