changed the solution from maxime's to mine and used randi for s&p