Paste number 26591: where wtf

Index of paste annotations: 1 | 2

Paste number 26591: where wtf
Pasted by: Tobsan
2 years, 3 months ago
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 1: fixed where
Pasted by: glguy
2 years, 3 months ago
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)

Annotation number 2: Indent fixes
Pasted by: ndm
2 years, 3 months ago
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)

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

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