Every time you change any cell, Excel recalculates all formulas.
Open the VBA editor, Double-Click to open the "ThisWorkbook" code page and place this code
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("A:A"), UsedRange) Is Nothing Then Exit Sub
With Target.Row 'The Entire Row of the Changed cell in Column A
If .Cells(2) = 1 Then '.Cells(2) is second cell in that Row
.Cells(3) = RANDBETWEEN(0, 9)
Else: .cells(3) = 0
End If
End With
End Sub
Delete Clear Contents on Column C. Every time you Change a value in A, that cell in C will change to reflect the situation in B.
You can Inititate the Change Event by merely entering and exiting a cell in A. IOW, Select a cell in A and hold down the enter key till the selection is at the bottom of the list.