Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 10 years ago

phoenix gravatar image

How does one get Sage to make random choices?

Like say in the middle of a code I compute a function value f(x) and I knwo that 0f(x)1. Now I want to write an if-then-else which will do one option with probability f(x) and the other otion with probability 1f(x). How does one make Sage do this?

Can somoen kindly show a template example to simulate this?