From e1a642e41e7e6d08303573fb20f265b4ac326372 Mon Sep 17 00:00:00 2001 From: pepperpepperpepper Date: Mon, 7 Dec 2015 14:40:04 -0800 Subject: added support for probabilities --- ricky/param/constrainednumber.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ricky/param/constrainednumber.py') diff --git a/ricky/param/constrainednumber.py b/ricky/param/constrainednumber.py index 3563d22..3af3bf9 100644 --- a/ricky/param/constrainednumber.py +++ b/ricky/param/constrainednumber.py @@ -73,7 +73,9 @@ class ConstrainedNumber(Param): value = int(value) self.value = value - def randomize(self, tries=0): + def randomize(self, tries=0, probabilities=None): + if probabilities and self._choose_from_probabilities(probabilities): + return tries_max = 30 try: self._generate_random() -- cgit v1.2.3-70-g09d2