public void mutate(){
        nets=SpeciationNeuralNetwork.sort(nets);
        while(nets.size()<maxAllowed) // add individuals if there are too few
            nets.add(nets.get(0).copyAndMutate());
        while(nets.size()>maxAllowed&&nets.size()>0) // remove individuals if there are too many
            nets.remove(nets.size()-1);
        // mutate every one
        Random random=new Random();
        for(int i=1;i<nets.size();i++){
            ArrayList<OutputNeuron> outputs=nets.get(i).findOutputs();
            for(int f=0;f<outputs.size();f++){
                try{
                    outputs.get(f).findDepth();
                }
                catch(Exception e){
                    new CMDTester(nets.get(i));
                    System.out.println("Encountered a stack overflow due to find depth. Setting this network's fitness low.");
                    nets.get(i).setFitness(Double.MIN_VALUE);
                }
            }
            double mORc=random.nextDouble();
            if(mORc>.8) // possibly make this global
                crossover(nets.get(i),random);
            else
                nets.set(i,nets.get(i).copyAndMutate());
        }
    }