+1 Nikhil
On Thu, Jul 28, 2011 at 4:26 PM, Nikhil Jindal 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 28, 2011 at 4:21
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 wrote:
> bool foo(int x)
>
> // Implement this function where 0 <= x
@KK
can you plz explain the return type of function a bit more
what do you mean by
It should return true x% of times n false otherwise
what is n here (is it "and" or some number) ..
On Thu, Jul 28, 2011 at 4:46 PM, Muthu Raj wrote:
> Please elaborate upon the question a little more :)
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 wrote:
> bool foo(int x)
>
> // Implement this function where 0 <= x <= 100
> It should return true x% of times n false otherwise
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 diff