Hi,
is the are way (or a build in method) in haskell to get a random number from
a number bottom to a number top?
Something like
let randomNumber = random 1 30
to get a random number between 1 and 30.
--
View this message in context:
look in System.Random
randomRIO :: (Random a) = (a, a) - IO a
you can do
randomNumber-randomRIO (1,30)
On Sun, Jun 7, 2009 at 3:33 PM, ptrash ptr...@web.de wrote:
Hi,
is the are way (or a build in method) in haskell to get a random number
from
a number bottom to a number top?
Something
On Sun, Jun 7, 2009 at 21:33, ptrashptr...@web.de wrote:
Hi,
is the are way (or a build in method) in haskell to get a random number from
a number bottom to a number top?
Something like
let randomNumber = random 1 30
to get a random number between 1 and 30.
I don't mean to be rude, but
On 7 Jun 2009, at 8:33 pm, ptrash wrote:
Hi,
is the are way (or a build in method) in haskell to get a random
number from
a number bottom to a number top?
Something like
let randomNumber = random 1 30
to get a random number between 1 and 30.
rand :: Int - Int - IO Int
rand low high =
Good essay.
Try this one for a laugh:
http://www.mcs.vuw.ac.nz/comp/Publications/CS-TR-02-9.abs.html
A good place to begin is PDF pg. 19.
Michael
--- On Sun, 6/7/09, Krzysztof Skrzętnicki gte...@gmail.com wrote:
From: Krzysztof Skrzętnicki gte...@gmail.com
Subject: Re: [Haskell-cafe
:
From: michael rice nowg...@yahoo.com
Subject: Re: [Haskell-cafe] Random number example
To: Ross Mellgren rmm-hask...@z.odi.ac
Cc: haskell-cafe@haskell.org
Date: Thursday, April 23, 2009, 5:49 PM
Hi Ross,
Thanks for going the extra mile. A lot of what you did I haven't
seen before, so it's going
= (\die2 - return (die1 + die2)))
rollNDice :: Int - Random [Int]
--- On Thu, 4/23/09, michael rice nowg...@yahoo.com wrote:
From: michael rice nowg...@yahoo.com
Subject: Re: [Haskell-cafe] Random number example
To: Ross Mellgren rmm-hask...@z.odi.ac
Cc: haskell-cafe@haskell.org
Date: Thursday
I pretty much followed the sequence of steps that led to this final code (see
below), but will be looking it over for a while to make sure it sinks in. In
the meantime, I get this when I try to use it (sumTwoDice) at the command line:
[mich...@localhost ~]$ ghci rand9
GHCi, version 6.10.1:
Am Donnerstag 23 April 2009 17:28:58 schrieb michael rice:
I pretty much followed the sequence of steps that led to this final code
(see below), but will be looking it over for a while to make sure it sinks
in. In the meantime, I get this when I try to use it (sumTwoDice) at the
command line:
So there are a couple problems. First is you are trying to rebind
prelude functions, when instead you should be creating an instance of
Monad. This requires a bit of shuffling because without language
extensions you can't instance Monad Random for your type of Random, as
it is a type
On Apr 23, 2009, at 11:28 , michael rice wrote:
interactive:1:0:
No instance for (Show (Seed - (Int, Seed)))
arising from a use of `print' at interactive:1:0-9
Possible fix:
add an instance declaration for (Show (Seed - (Int, Seed)))
In a stmt of a 'do' expression: print
-cafe] Random number example
To: michael rice nowg...@yahoo.com
Cc: haskell-cafe@haskell.org
Date: Thursday, April 23, 2009, 11:51 AM
So there are a couple problems. First is you are trying to rebind prelude
functions, when instead you should be creating an instance of Monad. This
requires a bit
hi, i have been trying to learn haskell and i would like to translate the
following object-oriented pseudo-code into working haskell code but i'm
stumped on how to write the next function in the haskell code. any help is
appreciated.
class Random
...
end
ran = Random.new(300)
ran.next() - this
david karapetyan wrote:
hi, i have been trying to learn haskell and i would like to translate
the following object-oriented pseudo-code into working haskell code
but i'm stumped on how to write the next function in the haskell code.
any help is appreciated.
class Random
...
end
ran =
14 matches
Mail list logo