-- |An agent that provides proper random values (numbers and strings). module QuicQuid.Agent.Random(randomAgent) where {- random(?X) ... prob: A random integer in a range: random(?X) A random real in a range: A random sequence of characters in a range: -} import qualified Data.Map as M import QuicQuid.Agent.Util import QuicQuid.Random(randomInt) randomAgent = answerAgent "random" "random (integer (variable ?R))" process where process qch = do (bs,replyCh) <- readAskChan qch let Just (Str r) = M.lookup "R" bs rand <- randomInt writeQueryChan replyCh $ M.fromList [(r,Num $ fromIntegral rand)]