Function math::round::stochastic
[−]
[src]
pub fn stochastic(value: f64, scale: u8) -> f64
Round half randomly up or down.
Round value
to scale
number of decimal digits
rounding half randomly up or down.
Arguments
value
- value to roundscale
- number of decimal digits
Example
use math::round; let rounded = round::stochastic(3.14159, 3); assert_eq!(rounded == 3.141 || rounded == 3.142, true);