implementation of mento-carlo using stream