From: simonmar Date: Wed, 29 Aug 2001 10:49:28 +0000 (+0000) Subject: [project @ 2001-08-29 10:49:28 by simonmar] X-Git-Tag: Approximately_9120_patches~1057 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=0c256695d64365ef6857ff11a289375a3c45b8e3;p=ghc-hetmet.git [project @ 2001-08-29 10:49:28 by simonmar] Add genRange method to class RandomGen, as per the revised Haskell 98 library report. --- diff --git a/ghc/lib/std/Random.lhs b/ghc/lib/std/Random.lhs index a6c0055..1f19b20 100644 --- a/ghc/lib/std/Random.lhs +++ b/ghc/lib/std/Random.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $Id: Random.lhs,v 1.24 2001/02/28 00:01:03 qrczak Exp $ +% $Id: Random.lhs,v 1.25 2001/08/29 10:49:28 simonmar Exp $ % % (c) The University of Glasgow, 1995-2000 % @@ -19,7 +19,7 @@ world.. \begin{code} module Random ( - RandomGen(next, split) + RandomGen(next, split, genRange) , StdGen , mkStdGen , Random ( random, randomR, @@ -53,12 +53,14 @@ import Char ( isSpace, chr, ord ) \begin{code} class RandomGen g where - next :: g -> (Int, g) - split :: g -> (g, g) + next :: g -> (Int, g) + split :: g -> (g, g) + genRange :: g -> (Int,Int) + + -- default mathod + genRange g = (minBound,maxBound) -\end{code} -\begin{code} data StdGen = StdGen Int Int