# Pastebin 7xbhVafj import random type I = cshort I2 = cshort T1 = object count: I lifetime: I2 T2 = object count: I lifetime: I2 var foo: bool const A = 1.cshort B = 2.cshort C = 3.cshort proc newCount(wd: T1): T2 = result.lifetime = wd.lifetime result.count = wd.count let minCount = if foo: wd.count else: [ A, wd.count - B ].max maxCount = [wd.count + B, C].min countRange = minCount..maxCount+1 while result.count == wd.count: result.count = countRange.random