We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
random.randint() multiple errors
Calls result in errors when minimal input is provided (no error if dtype is provided).
```
>>> import numpy as np
>>> import cunumeric as cn
>>> np.random.randint(1000)
293
>>> cn.random.randint(1000)
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py", line 113, in randint
    return nprandom.randint(low=low, high=high, size=size, dtype=dtype)
  File "mtrand.pyx", line 764, in numpy.random.mtrand.RandomState.randint
TypeError: Unsupported dtype dtype('float64') for randint
>>> cn.random.randint(1000,dtype=np.int32)
172
```
Calls result in errors when size is provided in array form (or if ND) (this happens regardless whether or not dtype is provided):
```
>>> cn.random.randint(1000,size=10)
array([317, 787, 968, 969,  10, 508, 778, 387, 976, 166])
>>> np.random.randint(1000,size=[10])
array([ 79, 325, 406, 740, 810, 830, 551, 640, 596, 857])
>>> cn.random.randint(1000,size=[10])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py", line 125, in randint
    result = ndarray(size, dtype=dtype)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/array.py", line 190, in __init__
    self._thunk = runtime.create_empty_thunk(shape, dtype, inputs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py", line 499, in create_empty_thunk
    self.is_eager_shape(computed_shape)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py", line 528, in is_eager_shape
    return volume <= self.max_eager_volume
TypeError: '<=' not supported between instances of 'list' and 'int'
>>> np.random.randint(1000,size=[10,10])
array([[ 33, 401, 305, 230, 610, 912, 661,  89, 245,  35],
       [639, 985, 902, 324, 270, 145, 121, 947, 817, 175],
       [458, 623, 160, 994, 263, 824, 304,  94, 492, 552],
       [907, 607,  16, 761, 323, 479, 122, 954, 749, 254],
       [146, 627, 161, 855, 573, 794, 731, 192, 988, 999],
       [628, 582, 815, 592, 765,  69, 416, 445, 339, 756],
       [504, 332, 910, 478,  14, 686,  77, 527, 186, 545],
       [353, 432,  38,  32, 229, 129, 248, 992, 292,  49],
       [380, 835, 754, 874, 136, 167, 497, 984, 951, 353],
       [164, 512, 899, 515, 405, 929, 268, 491, 542, 664]])
>>> cn.random.randint(1000,size=[10,10])
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py", line 125, in randint
    result = ndarray(size, dtype=dtype)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py", line 106, in wrapper
    return func(*args, **kwargs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/array.py", line 190, in __init__
    self._thunk = runtime.create_empty_thunk(shape, dtype, inputs)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py", line 499, in create_empty_thunk
    self.is_eager_shape(computed_shape)
  File "/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py", line 528, in is_eager_shape
    return volume <= self.max_eager_volume
TypeError: '<=' not supported between instances of 'list' and 'int'
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `cunumeric/random/random.py`
Content:
```
1 # Copyright 2021-2022 NVIDIA Corporation
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14 #
15 from __future__ import annotations
16 
17 from typing import TYPE_CHECKING, Any, Union
18 
19 import numpy as np
20 import numpy.random as nprandom
21 from cunumeric.array import ndarray
22 from cunumeric.runtime import runtime
23 
24 if TYPE_CHECKING:
25     import numpy.typing as npt
26 
27 
28 def seed(init: Union[int, None] = None) -> None:
29     if init is None:
30         init = 0
31     runtime.set_next_random_epoch(int(init))
32 
33 
34 def rand(*shapeargs: int) -> Union[float, ndarray]:
35     """
36     rand(d0, d1, ..., dn)
37 
38     Random values in a given shape.
39 
40     Create an array of the given shape and populate it with random samples from
41     a uniform distribution over ``[0, 1)``.
42 
43     Parameters
44     ----------
45     d0, d1, ..., dn : int, optional
46         The dimensions of the returned array, must be non-negative.
47         If no argument is given a single Python float is returned.
48 
49     Returns
50     -------
51     out : ndarray, shape ``(d0, d1, ..., dn)``
52         Random values.
53 
54     See Also
55     --------
56     numpy.random.rand
57 
58     Availability
59     --------
60     Multiple GPUs, Multiple CPUs
61     """
62 
63     if shapeargs == ():
64         return nprandom.rand()
65     result = ndarray(shapeargs, dtype=np.dtype(np.float64))
66     result._thunk.random_uniform()
67     return result
68 
69 
70 def randint(
71     low: Union[int, ndarray],
72     high: Union[int, ndarray, None] = None,
73     size: Union[int, tuple[int], None] = None,
74     dtype: Union[np.dtype[Any], None] = None,
75 ) -> Union[int, ndarray, npt.NDArray[Any]]:
76     """
77     Return random integers from `low` (inclusive) to `high` (exclusive).
78 
79     Parameters
80     ----------
81     low : int or array_like[int]
82         Lowest (signed) integers to be drawn from the distribution (unless
83         ``high=None``, in which case this parameter is one above the
84         *highest* such integer).
85     high : int or array_like[int], optional
86         If provided, one above the largest (signed) integer to be drawn
87         from the distribution (see above for behavior if ``high=None``).
88         If array-like, must contain integer values
89     size : int or tuple[int], optional
90         Output shape.  If the given shape is, e.g., ``(m, n, k)``, then
91         ``m * n * k`` samples are drawn.  Default is None, in which case a
92         single value is returned.
93     dtype : data-type, optional
94         Desired dtype of the result. Byteorder must be native.
95         The default value is int.
96 
97     Returns
98     -------
99     out : int or ndarray[int]
100         `size`-shaped array of random integers from the appropriate
101         distribution, or a single such random int if `size` not provided.
102 
103     See Also
104     --------
105     numpy.random.randint
106 
107     Availability
108     --------
109     Multiple GPUs, Multiple CPUs
110     """
111 
112     if size is None:
113         return nprandom.randint(low=low, high=high, size=size, dtype=dtype)
114     if dtype is not None:
115         dtype = np.dtype(dtype)
116     else:
117         dtype = np.dtype(np.int64)
118     # TODO: randint must support unsigned integer dtypes as well
119     if dtype.kind != "i":
120         raise TypeError(
121             "cunumeric.random.randint must be given an integer dtype"
122         )
123     if not isinstance(size, tuple):
124         size = (size,)
125     result = ndarray(size, dtype=dtype)
126     if high is None:
127         if low <= 0:
128             raise ValueError(
129                 "bound must be strictly greater than 0 for randint"
130             )
131         result._thunk.random_integer(low=0, high=low)
132     else:
133         if low >= high:
134             raise ValueError(
135                 "'high' bound must be strictly greater than 'low' "
136                 "bound for randint"
137             )
138         result._thunk.random_integer(low=low, high=high)
139     return result
140 
141 
142 def randn(*shapeargs: int) -> Union[float, ndarray]:
143     """
144     randn(d0, d1, ..., dn)
145 
146     Return a sample (or samples) from the "standard normal" distribution.
147 
148     Parameters
149     ----------
150     d0, d1, ..., dn : int, optional
151         The dimensions of the returned array, must be non-negative.
152         If no argument is given a single Python float is returned.
153 
154     Returns
155     -------
156     Z : ndarray or float
157         A ``(d0, d1, ..., dn)``-shaped array of floating-point samples from
158         the standard normal distribution, or a single such float if
159         no parameters were supplied.
160 
161     See Also
162     --------
163     numpy.random.randn
164 
165     Availability
166     --------
167     Multiple GPUs, Multiple CPUs
168     """
169 
170     if shapeargs == ():
171         return nprandom.randn()
172     result = ndarray(shapeargs, dtype=np.dtype(np.float64))
173     result._thunk.random_normal()
174     return result
175 
176 
177 def random(shape: Union[tuple[int], None] = None) -> Union[float, ndarray]:
178     """
179     random(size=None)
180 
181     Return random floats in the half-open interval [0.0, 1.0).
182 
183     See Also
184     --------
185     numpy.random.random
186 
187     Availability
188     --------
189     Multiple GPUs, Multiple CPUs
190     """
191     if shape is None:
192         return nprandom.random()
193     result = ndarray(shape, dtype=np.dtype(np.float64))
194     result._thunk.random_uniform()
195     return result
196
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/cunumeric/random/random.py b/cunumeric/random/random.py
--- a/cunumeric/random/random.py
+++ b/cunumeric/random/random.py
@@ -14,7 +14,7 @@
 #
 from __future__ import annotations
 
-from typing import TYPE_CHECKING, Any, Union
+from typing import TYPE_CHECKING, Any, Sequence, Union
 
 import numpy as np
 import numpy.random as nprandom
@@ -68,10 +68,10 @@
 
 
 def randint(
-    low: Union[int, ndarray],
-    high: Union[int, ndarray, None] = None,
-    size: Union[int, tuple[int], None] = None,
-    dtype: Union[np.dtype[Any], None] = None,
+    low: Union[int, Sequence[int]],
+    high: Union[int, Sequence[int], None] = None,
+    size: Union[int, Sequence[int], None] = None,
+    dtype: Union[np.dtype[Any], type, None] = int,
 ) -> Union[int, ndarray, npt.NDArray[Any]]:
     """
     Return random integers from `low` (inclusive) to `high` (exclusive).
@@ -109,8 +109,14 @@
     Multiple GPUs, Multiple CPUs
     """
 
+    if not isinstance(low, int):
+        raise NotImplementedError("'low' must be an integer")
+    if high is not None and not isinstance(high, int):
+        raise NotImplementedError("'high' must be an integer or None")
+
     if size is None:
         return nprandom.randint(low=low, high=high, size=size, dtype=dtype)
+
     if dtype is not None:
         dtype = np.dtype(dtype)
     else:
@@ -120,7 +126,7 @@
         raise TypeError(
             "cunumeric.random.randint must be given an integer dtype"
         )
-    if not isinstance(size, tuple):
+    if isinstance(size, int):
         size = (size,)
     result = ndarray(size, dtype=dtype)
     if high is None:

{"golden_diff": "diff --git a/cunumeric/random/random.py b/cunumeric/random/random.py\n--- a/cunumeric/random/random.py\n+++ b/cunumeric/random/random.py\n@@ -14,7 +14,7 @@\n #\n from __future__ import annotations\n \n-from typing import TYPE_CHECKING, Any, Union\n+from typing import TYPE_CHECKING, Any, Sequence, Union\n \n import numpy as np\n import numpy.random as nprandom\n@@ -68,10 +68,10 @@\n \n \n def randint(\n-    low: Union[int, ndarray],\n-    high: Union[int, ndarray, None] = None,\n-    size: Union[int, tuple[int], None] = None,\n-    dtype: Union[np.dtype[Any], None] = None,\n+    low: Union[int, Sequence[int]],\n+    high: Union[int, Sequence[int], None] = None,\n+    size: Union[int, Sequence[int], None] = None,\n+    dtype: Union[np.dtype[Any], type, None] = int,\n ) -> Union[int, ndarray, npt.NDArray[Any]]:\n     \"\"\"\n     Return random integers from `low` (inclusive) to `high` (exclusive).\n@@ -109,8 +109,14 @@\n     Multiple GPUs, Multiple CPUs\n     \"\"\"\n \n+    if not isinstance(low, int):\n+        raise NotImplementedError(\"'low' must be an integer\")\n+    if high is not None and not isinstance(high, int):\n+        raise NotImplementedError(\"'high' must be an integer or None\")\n+\n     if size is None:\n         return nprandom.randint(low=low, high=high, size=size, dtype=dtype)\n+\n     if dtype is not None:\n         dtype = np.dtype(dtype)\n     else:\n@@ -120,7 +126,7 @@\n         raise TypeError(\n             \"cunumeric.random.randint must be given an integer dtype\"\n         )\n-    if not isinstance(size, tuple):\n+    if isinstance(size, int):\n         size = (size,)\n     result = ndarray(size, dtype=dtype)\n     if high is None:\n", "issue": "random.randint() multiple errors\nCalls result in errors when minimal input is provided (no error if dtype is provided).\r\n```\r\n>>> import numpy as np\r\n>>> import cunumeric as cn\r\n>>> np.random.randint(1000)\r\n293\r\n>>> cn.random.randint(1000)\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py\", line 106, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py\", line 113, in randint\r\n    return nprandom.randint(low=low, high=high, size=size, dtype=dtype)\r\n  File \"mtrand.pyx\", line 764, in numpy.random.mtrand.RandomState.randint\r\nTypeError: Unsupported dtype dtype('float64') for randint\r\n>>> cn.random.randint(1000,dtype=np.int32)\r\n172\r\n```\r\nCalls result in errors when size is provided in array form (or if ND) (this happens regardless whether or not dtype is provided):\r\n```\r\n>>> cn.random.randint(1000,size=10)\r\narray([317, 787, 968, 969,  10, 508, 778, 387, 976, 166])\r\n>>> np.random.randint(1000,size=[10])\r\narray([ 79, 325, 406, 740, 810, 830, 551, 640, 596, 857])\r\n>>> cn.random.randint(1000,size=[10])\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py\", line 106, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py\", line 125, in randint\r\n    result = ndarray(size, dtype=dtype)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py\", line 106, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/array.py\", line 190, in __init__\r\n    self._thunk = runtime.create_empty_thunk(shape, dtype, inputs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py\", line 499, in create_empty_thunk\r\n    self.is_eager_shape(computed_shape)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py\", line 528, in is_eager_shape\r\n    return volume <= self.max_eager_volume\r\nTypeError: '<=' not supported between instances of 'list' and 'int'\r\n>>> np.random.randint(1000,size=[10,10])\r\narray([[ 33, 401, 305, 230, 610, 912, 661,  89, 245,  35],\r\n       [639, 985, 902, 324, 270, 145, 121, 947, 817, 175],\r\n       [458, 623, 160, 994, 263, 824, 304,  94, 492, 552],\r\n       [907, 607,  16, 761, 323, 479, 122, 954, 749, 254],\r\n       [146, 627, 161, 855, 573, 794, 731, 192, 988, 999],\r\n       [628, 582, 815, 592, 765,  69, 416, 445, 339, 756],\r\n       [504, 332, 910, 478,  14, 686,  77, 527, 186, 545],\r\n       [353, 432,  38,  32, 229, 129, 248, 992, 292,  49],\r\n       [380, 835, 754, 874, 136, 167, 497, 984, 951, 353],\r\n       [164, 512, 899, 515, 405, 929, 268, 491, 542, 664]])\r\n>>> cn.random.randint(1000,size=[10,10])\r\nTraceback (most recent call last):\r\n  File \"<console>\", line 1, in <module>\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py\", line 106, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/random/random.py\", line 125, in randint\r\n    result = ndarray(size, dtype=dtype)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/coverage.py\", line 106, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/array.py\", line 190, in __init__\r\n    self._thunk = runtime.create_empty_thunk(shape, dtype, inputs)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py\", line 499, in create_empty_thunk\r\n    self.is_eager_shape(computed_shape)\r\n  File \"/rkarimi_l/Work/cunumeric/cunumeric/cunumeric/runtime.py\", line 528, in is_eager_shape\r\n    return volume <= self.max_eager_volume\r\nTypeError: '<=' not supported between instances of 'list' and 'int'\r\n```\r\n\n", "before_files": [{"content": "# Copyright 2021-2022 NVIDIA Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING, Any, Union\n\nimport numpy as np\nimport numpy.random as nprandom\nfrom cunumeric.array import ndarray\nfrom cunumeric.runtime import runtime\n\nif TYPE_CHECKING:\n    import numpy.typing as npt\n\n\ndef seed(init: Union[int, None] = None) -> None:\n    if init is None:\n        init = 0\n    runtime.set_next_random_epoch(int(init))\n\n\ndef rand(*shapeargs: int) -> Union[float, ndarray]:\n    \"\"\"\n    rand(d0, d1, ..., dn)\n\n    Random values in a given shape.\n\n    Create an array of the given shape and populate it with random samples from\n    a uniform distribution over ``[0, 1)``.\n\n    Parameters\n    ----------\n    d0, d1, ..., dn : int, optional\n        The dimensions of the returned array, must be non-negative.\n        If no argument is given a single Python float is returned.\n\n    Returns\n    -------\n    out : ndarray, shape ``(d0, d1, ..., dn)``\n        Random values.\n\n    See Also\n    --------\n    numpy.random.rand\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if shapeargs == ():\n        return nprandom.rand()\n    result = ndarray(shapeargs, dtype=np.dtype(np.float64))\n    result._thunk.random_uniform()\n    return result\n\n\ndef randint(\n    low: Union[int, ndarray],\n    high: Union[int, ndarray, None] = None,\n    size: Union[int, tuple[int], None] = None,\n    dtype: Union[np.dtype[Any], None] = None,\n) -> Union[int, ndarray, npt.NDArray[Any]]:\n    \"\"\"\n    Return random integers from `low` (inclusive) to `high` (exclusive).\n\n    Parameters\n    ----------\n    low : int or array_like[int]\n        Lowest (signed) integers to be drawn from the distribution (unless\n        ``high=None``, in which case this parameter is one above the\n        *highest* such integer).\n    high : int or array_like[int], optional\n        If provided, one above the largest (signed) integer to be drawn\n        from the distribution (see above for behavior if ``high=None``).\n        If array-like, must contain integer values\n    size : int or tuple[int], optional\n        Output shape.  If the given shape is, e.g., ``(m, n, k)``, then\n        ``m * n * k`` samples are drawn.  Default is None, in which case a\n        single value is returned.\n    dtype : data-type, optional\n        Desired dtype of the result. Byteorder must be native.\n        The default value is int.\n\n    Returns\n    -------\n    out : int or ndarray[int]\n        `size`-shaped array of random integers from the appropriate\n        distribution, or a single such random int if `size` not provided.\n\n    See Also\n    --------\n    numpy.random.randint\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if size is None:\n        return nprandom.randint(low=low, high=high, size=size, dtype=dtype)\n    if dtype is not None:\n        dtype = np.dtype(dtype)\n    else:\n        dtype = np.dtype(np.int64)\n    # TODO: randint must support unsigned integer dtypes as well\n    if dtype.kind != \"i\":\n        raise TypeError(\n            \"cunumeric.random.randint must be given an integer dtype\"\n        )\n    if not isinstance(size, tuple):\n        size = (size,)\n    result = ndarray(size, dtype=dtype)\n    if high is None:\n        if low <= 0:\n            raise ValueError(\n                \"bound must be strictly greater than 0 for randint\"\n            )\n        result._thunk.random_integer(low=0, high=low)\n    else:\n        if low >= high:\n            raise ValueError(\n                \"'high' bound must be strictly greater than 'low' \"\n                \"bound for randint\"\n            )\n        result._thunk.random_integer(low=low, high=high)\n    return result\n\n\ndef randn(*shapeargs: int) -> Union[float, ndarray]:\n    \"\"\"\n    randn(d0, d1, ..., dn)\n\n    Return a sample (or samples) from the \"standard normal\" distribution.\n\n    Parameters\n    ----------\n    d0, d1, ..., dn : int, optional\n        The dimensions of the returned array, must be non-negative.\n        If no argument is given a single Python float is returned.\n\n    Returns\n    -------\n    Z : ndarray or float\n        A ``(d0, d1, ..., dn)``-shaped array of floating-point samples from\n        the standard normal distribution, or a single such float if\n        no parameters were supplied.\n\n    See Also\n    --------\n    numpy.random.randn\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if shapeargs == ():\n        return nprandom.randn()\n    result = ndarray(shapeargs, dtype=np.dtype(np.float64))\n    result._thunk.random_normal()\n    return result\n\n\ndef random(shape: Union[tuple[int], None] = None) -> Union[float, ndarray]:\n    \"\"\"\n    random(size=None)\n\n    Return random floats in the half-open interval [0.0, 1.0).\n\n    See Also\n    --------\n    numpy.random.random\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n    if shape is None:\n        return nprandom.random()\n    result = ndarray(shape, dtype=np.dtype(np.float64))\n    result._thunk.random_uniform()\n    return result\n", "path": "cunumeric/random/random.py"}], "after_files": [{"content": "# Copyright 2021-2022 NVIDIA Corporation\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#     http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\nfrom __future__ import annotations\n\nfrom typing import TYPE_CHECKING, Any, Sequence, Union\n\nimport numpy as np\nimport numpy.random as nprandom\nfrom cunumeric.array import ndarray\nfrom cunumeric.runtime import runtime\n\nif TYPE_CHECKING:\n    import numpy.typing as npt\n\n\ndef seed(init: Union[int, None] = None) -> None:\n    if init is None:\n        init = 0\n    runtime.set_next_random_epoch(int(init))\n\n\ndef rand(*shapeargs: int) -> Union[float, ndarray]:\n    \"\"\"\n    rand(d0, d1, ..., dn)\n\n    Random values in a given shape.\n\n    Create an array of the given shape and populate it with random samples from\n    a uniform distribution over ``[0, 1)``.\n\n    Parameters\n    ----------\n    d0, d1, ..., dn : int, optional\n        The dimensions of the returned array, must be non-negative.\n        If no argument is given a single Python float is returned.\n\n    Returns\n    -------\n    out : ndarray, shape ``(d0, d1, ..., dn)``\n        Random values.\n\n    See Also\n    --------\n    numpy.random.rand\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if shapeargs == ():\n        return nprandom.rand()\n    result = ndarray(shapeargs, dtype=np.dtype(np.float64))\n    result._thunk.random_uniform()\n    return result\n\n\ndef randint(\n    low: Union[int, Sequence[int]],\n    high: Union[int, Sequence[int], None] = None,\n    size: Union[int, Sequence[int], None] = None,\n    dtype: Union[np.dtype[Any], type, None] = int,\n) -> Union[int, ndarray, npt.NDArray[Any]]:\n    \"\"\"\n    Return random integers from `low` (inclusive) to `high` (exclusive).\n\n    Parameters\n    ----------\n    low : int or array_like[int]\n        Lowest (signed) integers to be drawn from the distribution (unless\n        ``high=None``, in which case this parameter is one above the\n        *highest* such integer).\n    high : int or array_like[int], optional\n        If provided, one above the largest (signed) integer to be drawn\n        from the distribution (see above for behavior if ``high=None``).\n        If array-like, must contain integer values\n    size : int or tuple[int], optional\n        Output shape.  If the given shape is, e.g., ``(m, n, k)``, then\n        ``m * n * k`` samples are drawn.  Default is None, in which case a\n        single value is returned.\n    dtype : data-type, optional\n        Desired dtype of the result. Byteorder must be native.\n        The default value is int.\n\n    Returns\n    -------\n    out : int or ndarray[int]\n        `size`-shaped array of random integers from the appropriate\n        distribution, or a single such random int if `size` not provided.\n\n    See Also\n    --------\n    numpy.random.randint\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if not isinstance(low, int):\n        raise NotImplementedError(\"'low' must be an integer\")\n    if high is not None and not isinstance(high, int):\n        raise NotImplementedError(\"'high' must be an integer or None\")\n\n    if size is None:\n        return nprandom.randint(low=low, high=high, size=size, dtype=dtype)\n\n    if dtype is not None:\n        dtype = np.dtype(dtype)\n    else:\n        dtype = np.dtype(np.int64)\n    # TODO: randint must support unsigned integer dtypes as well\n    if dtype.kind != \"i\":\n        raise TypeError(\n            \"cunumeric.random.randint must be given an integer dtype\"\n        )\n    if isinstance(size, int):\n        size = (size,)\n    result = ndarray(size, dtype=dtype)\n    if high is None:\n        if low <= 0:\n            raise ValueError(\n                \"bound must be strictly greater than 0 for randint\"\n            )\n        result._thunk.random_integer(low=0, high=low)\n    else:\n        if low >= high:\n            raise ValueError(\n                \"'high' bound must be strictly greater than 'low' \"\n                \"bound for randint\"\n            )\n        result._thunk.random_integer(low=low, high=high)\n    return result\n\n\ndef randn(*shapeargs: int) -> Union[float, ndarray]:\n    \"\"\"\n    randn(d0, d1, ..., dn)\n\n    Return a sample (or samples) from the \"standard normal\" distribution.\n\n    Parameters\n    ----------\n    d0, d1, ..., dn : int, optional\n        The dimensions of the returned array, must be non-negative.\n        If no argument is given a single Python float is returned.\n\n    Returns\n    -------\n    Z : ndarray or float\n        A ``(d0, d1, ..., dn)``-shaped array of floating-point samples from\n        the standard normal distribution, or a single such float if\n        no parameters were supplied.\n\n    See Also\n    --------\n    numpy.random.randn\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n\n    if shapeargs == ():\n        return nprandom.randn()\n    result = ndarray(shapeargs, dtype=np.dtype(np.float64))\n    result._thunk.random_normal()\n    return result\n\n\ndef random(shape: Union[tuple[int], None] = None) -> Union[float, ndarray]:\n    \"\"\"\n    random(size=None)\n\n    Return random floats in the half-open interval [0.0, 1.0).\n\n    See Also\n    --------\n    numpy.random.random\n\n    Availability\n    --------\n    Multiple GPUs, Multiple CPUs\n    \"\"\"\n    if shape is None:\n        return nprandom.random()\n    result = ndarray(shape, dtype=np.dtype(np.float64))\n    result._thunk.random_uniform()\n    return result\n", "path": "cunumeric/random/random.py"}]}