Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mathlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'mathlib.py')
-rw-r--r--mathlib.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/mathlib.py b/mathlib.py
index 8cf1cca..07d342e 100644
--- a/mathlib.py
+++ b/mathlib.py
@@ -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))