comparison src/solver.tp @ 50:f4399a22a704

Fix crash from calling srand during module initialization
author Mike Pavone <pavone@retrodev.com>
date Sun, 11 Aug 2013 05:54:42 -0700
parents 8409af16d6e5
children f864792a1b17
comparison
equal deleted inserted replaced
49:8409af16d6e5 50:f4399a22a704
121 } 121 }
122 } 122 }
123 } 123 }
124 #{ 124 #{
125 classify <- :prog trees numTests { 125 classify <- :prog trees numTests {
126 (os srand: (os time))
126 testvals <- #[] 127 testvals <- #[]
127 i <- 0 128 i <- 0
128 (os srand: (os time))
129 while: {i < numTests} do: { 129 while: {i < numTests} do: {
130 i <- i + 1 130 i <- i + 1
131 testvals append: (uint64: (os rand64)) 131 testvals append: (uint64: (os rand64))
132 } 132 }
133 root <- _classifNode: testvals prog 0 false 133 root <- _classifNode: testvals prog 0 false
188 prog root!: tree 188 prog root!: tree
189 if: (prog run: failInput) = failOutput { 189 if: (prog run: failInput) = failOutput {
190 filtered append: tree 190 filtered append: tree
191 } 191 }
192 } 192 }
193 print: "Mismatch: went from " . (matches length) . " to " . (filtered length) . "\n"
193 matches <- filtered 194 matches <- filtered
194 if: (matches length) = 0 { 195 if: (matches length) = 0 {
195 print: "None of our programs actually matched 0x" . (hex: failOutput) ." with input 0x" . (hex: failInput) ." :(\n" 196 print: "None of our programs actually matched 0x" . (hex: failOutput) ." with input 0x" . (hex: failInput) ." :(\n"
196 } 197 }
197 } else: { 198 } else: {