I am writing java code to solve a problem with simulated annealing method. I need a method to generate a random true
only with probability exp(a/b) where a
and b
are given parameters.
Thanks.
I am writing java code to solve a problem with simulated annealing method. I need a method to generate a random true
only with probability exp(a/b) where a
and b
are given parameters.
Thanks.
Assuming that a/b
is the percentage probability of returning true:
public boolean exp(double probabilityTrue)
{
return Math.random() >= 1.0 - probabilityTrue;
}