Better FOA generation

Changed the random-FOA function to work in all cases and to execute much faster than before
Changed the example in -main

This change is rather irrelevant, feel free to ignore it