Module

Pha.Effects.Random

Package
purescript-pha
Repository
gbagan/purescript-pha

#RNG Source

type RNG = FProxy Rng

#randomNumber Source

randomNumber :: forall r. Run (rng :: RNG | r) Number

generate a random number in the range [0, 1)

#randomInt Source

randomInt :: forall r. Int -> Run (rng :: RNG | r) Int

generate a random integer in the range [0, n - 1]

#randomBool Source

randomBool :: forall r. Run (rng :: RNG | r) Boolean

generate a random boolean

#shuffle Source

shuffle :: forall a r. Array a -> Run (rng :: RNG | r) (Array a)

randomly shuffle an array

#sample Source

sample :: forall a r. Array a -> Run (rng :: RNG | r) (Maybe a)

randomly select an element from the array

#interpretRng Source

interpretRng :: forall r. Run (aff :: AFF, rng :: RNG | r) Unit -> Run (aff :: AFF | r) Unit

default implementation for random effects

#Rng Source

data Rng a

Constructors

Instances