Tuesday, February 7, 2012

acumen.util.Random

The acumen.util package contains the Random object, which ports part of the standard Haskell random generators to Scala. The generators are implemented using lazy values and may be used to produce streams of random Int or Double values that can be passed between objects, providing random values without the need for IO calls. The implementation currently suffers from a division by zero defect in the Int generator triggered when called from within the Double generator. The likely cause is that the Haskell version uses unbounded Integer values for most of the arithmetic while Random uses the Scala 32bit Int throughout. In the coming week Jan will make sure BigInt is used whenever Haskell uses Integer.