Implement (port) RandomFit algo, + tests