Skip to content

Commit ac3ad05

Browse files
committed
fix one of the failures
1 parent 1d9d490 commit ac3ad05

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/sage/categories/sets_cat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2476,7 +2476,7 @@ def random_element(self, *args):
24762476
True
24772477
"""
24782478
return self._cartesian_product_of_elements(
2479-
c.random_element(*args) for c in self.cartesian_factors())
2479+
c.random_element(*args) for c in self.cartesian_factors())
24802480

24812481
@abstract_method
24822482
def _sets_keys(self):

src/sage/rings/finite_rings/integer_mod_ring.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,14 +1541,15 @@ def random_element(self, bound=None):
15411541
sage: while not all(found):
15421542
....: found[R.random_element()] = True
15431543
1544-
We test ``bound``-option::
1544+
We test the ``bound`` option::
15451545
1546-
sage: R.random_element(2) in [R(16), R(17), R(0), R(1), R(2)]
1546+
sage: R.random_element(2) in [R(-2), R(-1), R(0), R(1), R(2)]
15471547
True
15481548
"""
15491549
if bound is not None:
1550-
return CommutativeRing.random_element(self, bound)
1551-
a = random.randint(0, self.order() - 1)
1550+
a = random.randint(-bound, bound)
1551+
else:
1552+
a = random.randint(0, self.order() - 1)
15521553
return self(a)
15531554

15541555
@staticmethod

0 commit comments

Comments
 (0)