[Haskell-cafe] St. Petersburg Game

Henning Thielemann lemming at henning-thielemann.de
Tue Nov 27 11:17:02 EST 2007


On Tue, 27 Nov 2007 manolo at austrohungaro.com wrote:

> Hello,
>
> I'm trying to program an implementation of the St. Petersburg game in
> Haskell. There is a coin toss implied, and the random-number generation is
> driving me quite mad. So far, I've tried this:
>
> import Random
>
> increment :: Int -> Int
> increment b = b + 1
>
>
> main =  do	let b = 0
> 		let c = randomRIO (1,2)
> 		until (c == 1)	increment b
>               	return b

http://www.haskell.org/pipermail/haskell-cafe/2006-December/020005.html



More information about the Haskell-Cafe mailing list