Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/mathlib.py
diff options
context:
space:
mode:
authorReinier Heeres <reinier@heeres.eu>2007-09-16 11:49:22 (GMT)
committer Reinier Heeres <reinier@heeres.eu>2007-09-16 11:49:22 (GMT)
commitfe7ae7de21b8cc29b40ff76387501b2ea3cf5faa (patch)
tree978c8b6168344e9b415a8612b1e738bb08d72ce1 /mathlib.py
parent94a8a56dfe083a7add66352f26179f425007ea4c (diff)
Bugfixes and improvements (help system, error reporting)
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))