heptagon/examples/random/markov.ept
Gwenaël Delaval d5ee87b7ed Added example Markov
Example Markov : simulation of a Markov chain.

Use of a Random module, external call to C rand() function.
2015-09-17 11:17:29 +02:00

20 lines
334 B
Text

open Random
const p : float = 0.3
unsafe node process() = (o:bool)
let
automaton
state A
var c : bool;
do o = false; c = random() <. p;
until c then B
| not c then C
state B
var c : bool;
do o = true; c = random() <. p
until c then A
state C
do o = false
end
tel