creatur 5.9.12 → 5.9.13
raw patch · 2 files changed
+3/−11 lines, 2 files
Files
creatur.cabal view
@@ -1,5 +1,5 @@ Name: creatur-Version: 5.9.12+Version: 5.9.13 Stability: experimental Synopsis: Framework for artificial life experiments. Description: A software framework for automating experiments@@ -28,15 +28,6 @@ Maintainer: amy@nualeargais.ie Build-Type: Simple Cabal-Version: >=1.8--source-repository head- type: git- location: https://github.com/mhwombat/creatur.git--source-repository this- type: git- location: https://github.com/mhwombat/creatur.git- tag: 5.9.10 library GHC-Options: -Wall -fno-warn-orphans
src/ALife/Creatur/Genetics/Recombination.hs view
@@ -29,6 +29,7 @@ import ALife.Creatur.Util (safeReplaceElement) import System.Random (Random)+import Control.Exception.Base (assert) import Control.Monad.Random (Rand, RandomGen, getRandom, getRandomR) -- | Cuts two lists at the specified locations, swaps the ends, and @@ -166,7 +167,7 @@ -- | Choose an element at random from a list and return the element and its -- index randomListSelection :: RandomGen g => [a] -> Rand g (Int, a)-randomListSelection xs = do+randomListSelection xs = assert (not . null $ xs) $ do i <- getRandomR (0,length xs - 1) return (i, xs !! i)