d5ee87b7ed
Example Markov : simulation of a Markov chain. Use of a Random module, external call to C rand() function.
20 lines
334 B
Text
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
|