Index: trunk/autoquest-core-testgeneration/src/main/java/de/ugoe/cs/autoquest/testgeneration/RandomWalkGenerator.java
===================================================================
--- trunk/autoquest-core-testgeneration/src/main/java/de/ugoe/cs/autoquest/testgeneration/RandomWalkGenerator.java	(revision 927)
+++ trunk/autoquest-core-testgeneration/src/main/java/de/ugoe/cs/autoquest/testgeneration/RandomWalkGenerator.java	(revision 2026)
@@ -74,4 +74,12 @@
     /**
      * <p>
+     * Maximal number of attempts for creating a valid sequence. If this value is reached, the
+     * sequence generation will be aborted.
+     * </p>
+     */
+    private final long maxIterValidSequence;
+
+    /**
+     * <p>
      * Actual number of random walks performed to generate the test suite.
      * </p>
@@ -103,4 +111,6 @@
      *            maximal number of random walks before aborting the test case generation (see
      *            {@link #maxIter})
+     * @param maxIterValidSequence
+     *            maximal number of attempts to create a valid sequence within the given restrictions
      */
     public RandomWalkGenerator(int numSequences,
@@ -108,5 +118,6 @@
                                int maxLength,
                                boolean validEnd,
-                               long maxIter)
+                               long maxIter,
+                               long maxIterValidSequence)
     {
         // check validity of the parameters
@@ -117,19 +128,22 @@
         if (maxLength < 1) {
             throw new IllegalArgumentException(
-                                                "maximal allowed length of test cases must be at least 1 but is " +
-                                                    maxLength);
+                                               "maximal allowed length of test cases must be at least 1 but is " +
+                                                   maxLength);
         }
         if (minLength > maxLength) {
             throw new IllegalArgumentException(
-                                                "minimal allowed length of test cases must be less than or equal to the maximal allowed length (min length: " +
-                                                    minLength + " ; max length: " + maxLength + ")");
+                                               "minimal allowed length of test cases must be less than or equal to the maximal allowed length (min length: " +
+                                                   minLength + " ; max length: " + maxLength + ")");
         }
         if (maxIter < numSequences) {
             throw new IllegalArgumentException(
-                                                "maximal number of iterations must greater than or equal to the number of sequences (number of sequences: " +
-                                                    numSequences +
-                                                    " ; max iterations: " +
-                                                    maxIter +
-                                                    ")");
+                                               "maximal number of iterations must greater than or equal to the number of sequences (number of sequences: " +
+                                                   numSequences +
+                                                   " ; max iterations: " +
+                                                   maxIter +
+                                                   ")");
+        }
+        if( maxIterValidSequence < 1) {
+            throw new IllegalArgumentException("maximal number of attempts to get a valid sequence must be positive, but is: " + maxIterValidSequence);
         }
         this.numSequences = numSequences;
@@ -138,4 +152,5 @@
         this.validEnd = validEnd;
         this.maxIter = maxIter;
+        this.maxIterValidSequence = maxIterValidSequence;
     }
 
@@ -157,5 +172,5 @@
         actualIter = 0;
         while (sequences.size() < numSequences && actualIter < maxIter) {
-            List<Event> generatedSequence = model.randomSequence(maxLength, validEnd);
+            List<Event> generatedSequence = model.randomSequence(maxLength, validEnd, maxIterValidSequence);
             if (generatedSequence.size() >= minLength && generatedSequence.size() <= maxLength) {
                 ((List<Event>) generatedSequence).add(0, Event.STARTEVENT);
