MukulShukla/xeger

generation of regex is not consistently repeatable

Opened this issue · 0 comments

If I want to use a Random with a fixed seem across two instances of Xeger this 
randomly fails to generate the same set of regex values.

The reason seems to be because Automatom internally uses Set for most 
everything and the order of the Transitions is not guaranteed regardless if the 
regex are the same.

The solution is to change from using 

List<Transition> transitions = state.getSortedTransitions(true);

to 

List<Transition> transitions = state.getSortedTransitions(false);

This ensures that the order of transitions is consistent (because it is using 
the min / max values rather than the State number values which can differ)

I am unsure if this will always solve the problem.  The more bullet proof 
approach would be to get the upstream Automatum to use List rather than Set.

Original issue reported on code.google.com by jasonmp...@gmail.com on 26 Jul 2012 at 2:00

Attachments: