From f00af6b1cc00ebcef59515481cb753ec9ab69163 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Pecka?= <peckato1@fit.cvut.cz>
Date: Wed, 30 Apr 2014 16:15:11 +0200
Subject: [PATCH] arand: Always generate at least one final state.

---
 arand/src/RandomAutomatonFactory.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arand/src/RandomAutomatonFactory.cpp b/arand/src/RandomAutomatonFactory.cpp
index c530569cf1..f539e470a1 100644
--- a/arand/src/RandomAutomatonFactory.cpp
+++ b/arand/src/RandomAutomatonFactory.cpp
@@ -130,8 +130,14 @@ FSM RandomAutomatonFactory::LeslieConnectedNFA( size_t n, const deque<Symbol> &
             automata.addFinalState( q );
     }
 
-    if( n == 1 )
-        automata.addFinalState( * automata.getInitialStates( ).begin( ) );
+    if( automata.getFinalStates( ).size( ) == 0 )
+    {
+        if( n == 1 )
+            automata.addFinalState( * automata.getInitialStates( ).begin( ) );
+        else
+            //todo: change
+            automata.addFinalState( * automata.getInitialStates( ).begin( ) );
+    }
 
     double mnn100 = 100.0 / alphabet.size( ) / n / n;
     while( automata.getTransitions( ).size( ) * mnn100 < density )
-- 
GitLab