vendredi 2 avril 2021

Displaying bool values - probability

I'm trying to solve the task below, but I have not any idea for this. May someone help with it?

Write a 'bernoulli' function that takes a real number 'p' from 0 to 1 inclusive and returns true with probability 'p' or false with probability '1-p'. The function uses only the 'cstdlib' header file.

Aucun commentaire:

Enregistrer un commentaire