MarkovChain

class MarkovChain<out R : Any>(seed: suspend () -> R, gen: suspend (R) -> R) : Chain<R>

A stateless Markov chain

Constructors

Link copied to clipboard
fun <out R : Any> MarkovChain(seed: suspend () -> R, gen: suspend (R) -> R)

Functions

Link copied to clipboard
open suspend override fun collect(collector: FlowCollector<R>)
Link copied to clipboard
open suspend override fun fork(): Chain<R>

Create a copy of current chain state. Consuming resulting chain does not affect initial chain.

Link copied to clipboard
open suspend override fun next(): R

Generate next value, changing state if needed

Link copied to clipboard
fun value(): R?

Properties

Link copied to clipboard
val gen: suspend (R) -> R
Link copied to clipboard
var value: R? = null

Sources

Link copied to clipboard