ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 09 Feb 2015 22:54:11 +0100How does one get Sage to make random choices?https://ask.sagemath.org/question/25783/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 $0 \leq f(x) \leq 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 $1-f(x)$. How does one make Sage do this?
Can somoen kindly show a template example to simulate this? phoenixMon, 09 Feb 2015 22:54:11 +0100https://ask.sagemath.org/question/25783/