Paste number 26591: where wtf

Index of paste annotations: 2 | 1

Paste number 26591: where wtf
Pasted by: Tobsan
When:3 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+KIN
Channel:None
Paste contents:
Raw Source | XML | Display As

--This obviously works...
twoRandomIntegers :: StdGen -> (Integer , Integer)
twoRandomIntegers g = (n1 , n2 )
  where (n1 , g1 ) = randomR (0, 10) g
        (n2 , g2 ) = randomR (0, 10) g1

--then why not this?
shuffle' :: Integer -> Hand -> StdGen -> Hand
shuffle' indx Empty rnd     = Empty
shuffle' indx (Add c h) rnd = Add( theCard (shuffle' newIndx newDeck gen) )
											where (theCard, newDeck) = getCard indx (Add c h)
														newIndx = randomR (0, sizeH hand)

Annotations for this paste:

Annotation number 2: Indent fixes
Pasted by: ndm
When:3 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+KIN/2
Paste contents:
Raw Source | Display As
shuffle' :: Integer -> Hand -> StdGen -> Hand
shuffle' indx Empty rnd     = Empty
shuffle' indx (Add c h) rnd = Add( theCard (shuffle' newIndx newDeck gen) )
   where
         (theCard, newDeck) = getCard indx (Add c h)
         newIndx = randomR (0, sizeH hand)

Annotation number 1: fixed where
Pasted by: glguy
When:3 years, 4 months ago
Share:Tweet this! | http://paste.lisp.org/+KIN/1
Paste contents:
Raw Source | Display As
--then why not this?
shuffle' :: Integer -> Hand -> StdGen -> Hand
shuffle' indx Empty rnd     = Empty
shuffle' indx (Add c h) rnd = Add( theCard (shuffle' newIndx newDeck gen) )
   where (theCard, newDeck) = getCard indx (Add c h)
         newIndx = randomR (0, sizeH hand)

Colorize as:
Show Line Numbers
Index of paste annotations: 2 | 1

Lisppaste pastes can be made by anyone at any time. Imagine a fearsomely comprehensive disclaimer of liability. Now fear, comprehensively.