4747//| bytes from `os.urandom` directly for true randomness."""
4848//|
4949
50- //| def seed(seed: Any ) -> Any :
50+ //| def seed(seed: int ) -> None :
5151//| """Sets the starting seed of the random number generation. Further calls to
5252//| `random` will return deterministic results afterwards."""
5353//| ...
@@ -59,7 +59,7 @@ STATIC mp_obj_t random_seed(mp_obj_t seed_in) {
5959}
6060STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_seed_obj , random_seed );
6161
62- //| def getrandbits(k: Any ) -> Any :
62+ //| def getrandbits(k: int ) -> int :
6363//| """Returns an integer with *k* random bits."""
6464//| ...
6565//|
@@ -72,7 +72,7 @@ STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) {
7272}
7373STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_getrandbits_obj , random_getrandbits );
7474
75- //| def randrange(stop: Any ) -> Any :
75+ //| def randrange(stop: Tuple[int, int, int] ) -> int :
7676//| """Returns a randomly selected integer from ``range(start, stop, step)``."""
7777//| ...
7878//|
@@ -114,7 +114,7 @@ STATIC mp_obj_t random_randrange(size_t n_args, const mp_obj_t *args) {
114114}
115115STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (random_randrange_obj , 1 , 3 , random_randrange );
116116
117- //| def randint(a: Any , b: Any ) -> Any :
117+ //| def randint(a: int , b: int ) -> int :
118118//| """Returns a randomly selected integer between a and b inclusive. Equivalent
119119//| to ``randrange(a, b + 1, 1)``"""
120120//| ...
@@ -129,7 +129,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) {
129129}
130130STATIC MP_DEFINE_CONST_FUN_OBJ_2 (random_randint_obj , random_randint );
131131
132- //| def choice(seq: Any ) -> Any:
132+ //| def choice(seq: list ) -> Any:
133133//| """Returns a randomly selected element from the given sequence. Raises
134134//| IndexError when the sequence is empty."""
135135//| ...
@@ -143,7 +143,7 @@ STATIC mp_obj_t random_choice(mp_obj_t seq) {
143143}
144144STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_choice_obj , random_choice );
145145
146- //| def random() -> Any :
146+ //| def random() -> float :
147147//| """Returns a random float between 0 and 1.0."""
148148//| ...
149149//|
@@ -152,7 +152,7 @@ STATIC mp_obj_t random_random(void) {
152152}
153153STATIC MP_DEFINE_CONST_FUN_OBJ_0 (random_random_obj , random_random );
154154
155- //| def uniform(a: Any , b: Any ) -> Any :
155+ //| def uniform(a: float , b: float ) -> float :
156156//| """Returns a random float between a and b. It may or may not be inclusive
157157//| depending on float rounding."""
158158//| ...
0 commit comments