bool foo(int x)
// Implement this function where 0 = x = 100
It should return true x% of times n false otherwise
first i told him to have a static int s then increment it each time
the func is called...
and if s % (100 - x ) == 0 then true else false.
then he told me to have some
Please elaborate upon the question a little more :)
*Muthuraj R.
4TH Year BE.**
Information Science Dept*
*PESIT, Bengaluru .
*
On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote:
bool foo(int x)
// Implement this function where 0 = x = 100
It should return true x% of
Generate a random number from 1 to 100.
If it is less than or equal to x, return true, else return false.
This will ensure that ur returning true with x/100 probability.
Cheers
Nikhil Jindal
On Thu, Jul 28, 2011 at 4:21 PM, KK kunalkapadi...@gmail.com wrote:
bool foo(int x)
// Implement this
+1 Nikhil
On Thu, Jul 28, 2011 at 4:26 PM, Nikhil Jindal fundoon...@yahoo.co.in wrote:
Generate a random number from 1 to 100.
If it is less than or equal to x, return true, else return false.
This will ensure that ur returning true with x/100 probability.
Cheers
Nikhil Jindal
On Thu, Jul