vbAccelerator - Contents of code file: frmCellularRandom.frm

VERSION 5.00
Begin VB.Form frmCellularRandom 
   Caption         =   "Cellular Automata Random Boolean Generator "
   ClientHeight    =   3540
   ClientLeft      =   2040
   ClientTop       =   1740
   ClientWidth     =   5205
   Icon            =   "frmCellularRandom.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   3540
   ScaleWidth      =   5205
   Begin VB.CommandButton cmdNext 
      Caption         =   "&Next"
      Height          =   435
      Left            =   1500
      TabIndex        =   0
      Top             =   1320
      Width           =   1695
   End
   Begin VB.Label lblTails 
      Alignment       =   2  'Center
      BackColor       =   &H00000000&
      Caption         =   "0"
      Height          =   675
      Left            =   2340
      TabIndex        =   2
      Tag             =   "0"
      Top             =   600
      Width           =   795
   End
   Begin VB.Label lblHeads 
      Alignment       =   2  'Center
      BackColor       =   &H00000000&
      Caption         =   "0"
      Height          =   675
      Left            =   1500
      TabIndex        =   1
      Tag             =   "0"
      Top             =   600
      Width           =   795
   End
End
Attribute VB_Name = "frmCellularRandom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private rand As New cCellularRandom

Private Sub nextRandom()
   
   Dim bValue As Boolean
   bValue = rand.nextRandom
   
   
   If (bValue) Then
      lblHeads.Tag = lblHeads.Tag + 1
   Else
      lblTails.Tag = lblTails.Tag + 1
   End If
   lblHeads.Caption = vbCrLf & "Heads" & vbCrLf & lblHeads.Tag
   lblTails.Caption = vbCrLf & "Tails" & vbCrLf & lblTails.Tag
   lblHeads.BackColor = IIf(bValue, &HFFFFFF, &H0)
   lblHeads.ForeColor = IIf(bValue, &H0, &HFFFFFF)
   lblTails.BackColor = IIf(bValue, &H0, &HFFFFFF)
   lblTails.ForeColor = IIf(bValue, &HFFFFFF, &H0)
   
End Sub

Private Sub cmdNext_Click()
   nextRandom
End Sub


Private Sub Form_Load()
   rand.Seed Timer
   nextRandom
End Sub