src/main/java/org/thegalactic/rule/ImplicationalSystem.java
public static ImplicationalSystem random(int nbS, int nbR) {
        ImplicationalSystem sigma = new ImplicationalSystem();
        // addition of elements
        for (int i = 0; i < nbS; i++) {
            sigma.addElement(Integer.valueOf(i));
        }
        // addition of rules
        //for (int i = 0; i < nbR; i++) { One could get twice the same rule ...
        while (sigma.getRules().size() < nbR) {
            ComparableSet conclusion = new ComparableSet();
            int choice = (int) Math.rint(nbS * Math.random());
            int j = 1;
            for (Comparable c : sigma.getSet()) {
                if (j == choice) {
                    conclusion.add(c);
                }
                j++;
            }
            ComparableSet premisse = new ComparableSet();
            for (Comparable c : sigma.getSet()) {
                choice = (int) Math.rint(nbS * Math.random());
                if (choice < nbS / 5) {
                    premisse.add(c);
                }
            }
            //if (!premisse.isEmpty()) {
            sigma.addRule(new Rule(premisse, conclusion));
            //}
        }
        return sigma;
    }
/**
     * Generates a random ImplicationalSystem with a specified number of nodes
     * and rules.
     *
     * @param nbS the number of nodes of the generated ImplicationalSystem
     * @param nbR the number of rules of the generated ImplicationalSystem
     *
     * @return a random implicational system with a specified number of nodes
     *         and rules.
     */
Generates a random ImplicationalSystem with a specified number of nodes
and rules.

@param nbS the number of nodes of the generated ImplicationalSystem
@param nbR the number of rules of the generated ImplicationalSystem

@return a random implicational system with a specified number of nodes
and rules.
Generates a random ImplicationalSystem with a specified number of nodes and rules . @param nbS the number of nodes of the generated ImplicationalSystem @param nbR the number of rules of the generated ImplicationalSystem @return a random implicational system with a specified number of nodes and rules .
public static ImplicationalSystem random(int nbS, int nbR) {
        ImplicationalSystem sigma = new ImplicationalSystem();
        for (int i = 0; i < nbS; i++) {
            sigma.addElement(Integer.valueOf(i));
        }
        while (sigma.getRules().size() < nbR) {
            ComparableSet conclusion = new ComparableSet();
            int choice = (int) Math.rint(nbS * Math.random());
            int j = 1;
            for (Comparable c : sigma.getSet()) {
                if (j == choice) {
                    conclusion.add(c);
                }
                j++;
            }
            ComparableSet premisse = new ComparableSet();
            for (Comparable c : sigma.getSet()) {
                choice = (int) Math.rint(nbS * Math.random());
                if (choice < nbS / 5) {
                    premisse.add(c);
                }
            }
            sigma.addRule(new Rule(premisse, conclusion));
        }
        return sigma;
    }
public static ImplicationalSystem random ( int nbS , int nbR ) { ImplicationalSystem sigma = new ImplicationalSystem ( ) ; for ( int i = 0 ; i < nbS ; i ++ ) { sigma . addElement ( Integer . valueOf ( i ) ) ; } while ( sigma . getRules ( ) . size ( ) < nbR ) { ComparableSet conclusion = new ComparableSet ( ) ; int choice = ( int ) Math . rint ( nbS * Math . random ( ) ) ; int j = 1 ; for ( Comparable c : sigma . getSet ( ) ) { if ( j == choice ) { conclusion . add ( c ) ; } j ++ ; } ComparableSet premisse = new ComparableSet ( ) ; for ( Comparable c : sigma . getSet ( ) ) { choice = ( int ) Math . rint ( nbS * Math . random ( ) ) ; if ( choice < nbS / 5 ) { premisse . add ( c ) ; } } sigma . addRule ( new Rule ( premisse , conclusion ) ) ; } return sigma ; }
Generates a random ImplicationalSystem with a specified number of nodes
 and rules.
Generates a random ImplicationalSystem with a specified number of nodes and rules .
// addition of elements // addition of rules //for (int i = 0; i < nbR; i++) { One could get twice the same rule ... //if (!premisse.isEmpty()) { //}