Skip to content
Snippets Groups Projects
Commit a3ccf6e3 authored by Chris's avatar Chris
Browse files

Update minor mistakes with string addition and random choice

parent 1a6b449f
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,11 @@ class BInteger: ...@@ -10,6 +10,11 @@ class BInteger:
return str(self) + other return str(self) + other
return BInteger(self.__value + other.__value) return BInteger(self.__value + other.__value)
def __radd__(self, other):
if type(other) == str:
return other + str(self)
return BInteger(self.__value + other.__value)
def __sub__(self, other: 'BInteger') -> 'BInteger': def __sub__(self, other: 'BInteger') -> 'BInteger':
return BInteger(self.__value - other.__value) return BInteger(self.__value - other.__value)
......
...@@ -510,7 +510,7 @@ class BRelation: ...@@ -510,7 +510,7 @@ class BRelation:
i = i + 1 i = i + 1
_range = self.map[domain_element] _range = self.map[domain_element]
index = random.choice(range(_range.size())) index = random.choice(range(len(_range)))
i = 0 i = 0
for obj in _range: for obj in _range:
if i == index: if i == index:
......
...@@ -106,7 +106,10 @@ class BSet: ...@@ -106,7 +106,10 @@ class BSet:
return self.__ne__(other) return self.__ne__(other)
def nondeterminism(self): def nondeterminism(self):
return random.choice(self.__set) values = []
for item in self.__set:
values.append(item)
return self.__set[random.choice(values)]
def min(self): def min(self):
return min(self.__set) return min(self.__set)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment