Skip to content

Commit

Permalink
Merge pull request #1430 from toslunar/rand-interval
Browse files Browse the repository at this point in the history
Make the method `cupy.random.RandomState.interval` private
  • Loading branch information
okuta committed Jul 2, 2018
2 parents 5cb3958 + 2dc0881 commit 067f830
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions cupy/random/generator.py
Expand Up @@ -182,7 +182,7 @@ def random_sample(self, size=None, dtype=float):
RandomState._1m_kernel(out)
return out

def interval(self, mx, size):
def _interval(self, mx, size):
"""Generate multiple integers independently sampled uniformly from ``[0, mx]``.
Args:
Expand All @@ -202,7 +202,7 @@ def interval(self, mx, size):
a ``numpy.uint32`` array is returned.
"""
if size is None:
return self.interval(mx, 1).reshape(())
return self._interval(mx, 1).reshape(())
elif isinstance(size, int):
size = (size, )

Expand Down Expand Up @@ -490,7 +490,7 @@ def randint(self, low, high=None, size=None, dtype='l'):
raise NotImplementedError(
'Sampling from a range whose extent is larger than int32 '
'range is currently not supported')
x = self.interval(diff, size).astype(dtype, copy=False)
x = self._interval(diff, size).astype(dtype, copy=False)
cupy.add(x, lo, out=x)
return x

Expand Down
2 changes: 1 addition & 1 deletion tests/cupy_tests/random_tests/test_generator.py
Expand Up @@ -258,7 +258,7 @@ def test_randn_invalid_argument(self):
@testing.gpu
class TestInterval(RandomGeneratorTestCase):

target_method = 'interval'
target_method = '_interval'

def test_zero(self):
shape = (2, 3)
Expand Down

0 comments on commit 067f830

Please sign in to comment.