Files
loop/src/Dodge/Randify.hs
T
2026-01-23 09:59:18 +00:00

22 lines
574 B
Haskell

module Dodge.Randify (
gRandify,
runStateWorld,
) where
import Control.Lens
--import Control.Monad.State
import Control.Monad.Trans.State.Lazy
import Dodge.Data.GenWorld
import System.Random
gRandify :: GenWorld -> State StdGen GenWorld -> GenWorld
gRandify gw mw =
let (gw', g) = runState mw (_randGen $ _gwWorld gw)
in gw' & gwWorld . randGen .~ g
-- this can possibly be done using zoom in a clever way
runStateWorld :: World -> State StdGen World -> World
runStateWorld gw mw =
let (gw', g) = runState mw (_randGen gw)
in gw' & randGen .~ g