diff options
Diffstat (limited to 'mathlib.py')
-rw-r--r-- | mathlib.py | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -20,6 +20,7 @@ import types import math from decimal import Decimal +import random import logging _logger = logging.getLogger('MathLib') @@ -252,6 +253,12 @@ class MathLib: def ceil(self, x): return self.d(math.ceil(x)) + def rand_float(self): + return self.d(random.random()) + + def rand_int(self): + return self.d(random.randint(0, 65535)) + def shift_left(self, x, y): if self.is_int(x) and self.is_int(y): return self.d(int(x) << int(y)) |