implemented a random solver