Skip to content

Commit

Permalink
Allow p=0 and p=1 for Bernoulli distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien committed Dec 3, 2012
1 parent 949da45 commit d4e443a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/TH/THRandom.c
Expand Up @@ -233,6 +233,6 @@ int THRandom_geometric(double p)

int THRandom_bernoulli(double p)
{
THArgCheck(p > 0 && p < 1, 1, "must be > 0 and < 1");
THArgCheck(p >= 0 && p <= 1, 1, "must be >= 0 and <= 1");
return(__uniform__() <= p);
}

0 comments on commit d4e443a

Please sign in to comment.