diff options
Diffstat (limited to 'ricky/param/bool.py')
| -rw-r--r-- | ricky/param/bool.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/ricky/param/bool.py b/ricky/param/bool.py index 961912e..2b25bbd 100644 --- a/ricky/param/bool.py +++ b/ricky/param/bool.py @@ -34,3 +34,10 @@ class Bool(Param): def randomize(self): self.value_set(random.choice([True, False])) + + def from_normalized(self, value): + value_as_int = int(round(value, 0)) + self.value = True if value_as_int else False + + def as_normalized(self): + return 1 if self.value else 0 |
