Skip to main content
added 76 characters in body
Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Haskell, 7474 71 bytes

-3 bytes by actually doing what the specs say it should do.

import System.Random f 0=pure[]0=pure[0] f x=do y<-randomRIOx=randomRIO(0::Int,x-1);>>=fmap(yx:)<$>f y.f 

Try it online!Try it online!

Haskell, 74 bytes

import System.Random f 0=pure[] f x=do y<-randomRIO(0::Int,x-1);(y:)<$>f y 

Try it online!

Haskell, 74 71 bytes

-3 bytes by actually doing what the specs say it should do.

import System.Random f 0=pure[0] f x=randomRIO(0::Int,x-1)>>=fmap(x:).f 

Try it online!

Source Link
ბიმო
  • 17k
  • 3
  • 43
  • 106

Haskell, 74 bytes

import System.Random f 0=pure[] f x=do y<-randomRIO(0::Int,x-1);(y:)<$>f y 

Try it online!