#### Generating Random Automatons

#### Generating Random Automatons

To generate a random deterministic finite automaton, the following command can be used:

$ ./test -o `out_file` -i `random_seed` [ -C `VAL` ] `num_in_sig` `num_out_sig` `num_states`

The command creates file `out_file` with a description of deterministic finite automaton produced using seed `random_seed`.
The automaton has given numbers of input, output signals, and states.
A random seed should always be specified; otherwise some standard fixed value will be used.
The first output signal will have spur increment 1 and all others 0.

If the option `-C ``VAL` with non-zero `VAL` is specified, then the automaton will have its state graph connected.
If `VAL` is a number greater than 0, then the automaton will have not more than that number of cycles in the graph, and the best cycle among them will be found.
If the number is relatively small, then the automaton may not be generated at one push.
When an attempt to generate the automaton fails, a warning message is printed, and the program makes another attempt.
If the number is relatively big, then an attempt to generate the automaton may take a long time, so the impression can be that the program has hung.

In QSMM version 1.16, there are supported `VAL`=‘`c`’ and `VAL`=‘`cs`’.
Value ‘`c`’ makes the program to provide state connectivity of the state graph and to find the best cycle in the graph using an algorithm analogous to Viterbi one.
Value ‘`cs`’ makes the program to provide the state connectivity, simplify the state graph, as it performed when `VAL` is a number greater than 0, and find the best cycle in the graph using an algorithm analogous to Viterbi one.

To comment lines before the first empty line in `out_file` the value of random seed is written.
If the option `-C ``VAL` with non-zero `VAL` is specified, then to comment lines will also be written information on the best cycle in the state graph:

- – the length of the best cycle (a cycle, continuous repeating of which will give the maximum amount of spur to the system);
- – the increment in spur the system will receive when the cycle is repeated;
- – average spur increment per that cycle step;
- – the list of cycle steps;
the description of each cycle step contains step index
`stp`, automaton state index `stt`, input signal `inp` received when the automaton was in that state, output signal `out` emitted, and spur increment `spr` that corresponds to the output signal.