8
$\begingroup$

How do you add a refresh button to

Manipulate[RandomVariate[BernoulliDistribution[p], 10], {p, 0, 1}]

that will re-evaluate RandomVariate[BernoulliDistribution[p], 10] when clicked?

$\endgroup$
4
$\begingroup$

The following works :

   Manipulate[
     Typeset`update$$; 
     RandomVariate[BernoulliDistribution[p], 10], {p, 0, 1},
     AppearanceElements -> "UpdateButton"]

enter image description here

To update press the button "U" at the top-right.
Of course, if you move the cursor it updates too.

$\endgroup$
7
$\begingroup$
Manipulate[
 r; 
 RandomVariate[BernoulliDistribution[p], 10], 
 {p, 0, 1}, {{r, True}, None},
 Button["refresh", r = ! r]]

Out

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.