Skip to content

Commit

Permalink
Fix legacy adaptor .integers()
Browse files Browse the repository at this point in the history
  • Loading branch information
john-zielke-snkeos committed Aug 23, 2023
1 parent 3372f89 commit c564ded
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion monai/utils/utils_random_generator_adaptor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ def __init__(self, seed: int | None = None, random_state: np.random.RandomState
def integers(
self, low: int, high: int | None = None, size: ShapeLike | None = None, dtype=DtypeLike, endpoint: bool = False
) -> NdarrayTensor:
return self.random_state.randint(low=low, high=high if endpoint else high + 1, size=size, dtype=dtype)
if endpoint:
if high is not None:
high += 1
else:
low += 1
return self.random_state.randint(low=low, high=high, size=size, dtype=dtype)

def random(self, size: ShapeLike | None = None, dtype=DtypeLike, out: NdarrayTensor | None = None) -> NdarrayTensor:
if out is not None:
Expand Down

0 comments on commit c564ded

Please sign in to comment.