47
47
//| bytes from `os.urandom` directly for true randomness."""
48
48
//|
49
49
50
- //| def seed(seed: Any ) -> Any :
50
+ //| def seed(seed: int ) -> None :
51
51
//| """Sets the starting seed of the random number generation. Further calls to
52
52
//| `random` will return deterministic results afterwards."""
53
53
//| ...
@@ -59,7 +59,7 @@ STATIC mp_obj_t random_seed(mp_obj_t seed_in) {
59
59
}
60
60
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_seed_obj , random_seed );
61
61
62
- //| def getrandbits(k: Any ) -> Any :
62
+ //| def getrandbits(k: int ) -> int :
63
63
//| """Returns an integer with *k* random bits."""
64
64
//| ...
65
65
//|
@@ -72,7 +72,7 @@ STATIC mp_obj_t random_getrandbits(mp_obj_t num_in) {
72
72
}
73
73
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_getrandbits_obj , random_getrandbits );
74
74
75
- //| def randrange(stop: Any ) -> Any :
75
+ //| def randrange(stop: Tuple[int, int, int] ) -> int :
76
76
//| """Returns a randomly selected integer from ``range(start, stop, step)``."""
77
77
//| ...
78
78
//|
@@ -114,7 +114,7 @@ STATIC mp_obj_t random_randrange(size_t n_args, const mp_obj_t *args) {
114
114
}
115
115
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN (random_randrange_obj , 1 , 3 , random_randrange );
116
116
117
- //| def randint(a: Any , b: Any ) -> Any :
117
+ //| def randint(a: int , b: int ) -> int :
118
118
//| """Returns a randomly selected integer between a and b inclusive. Equivalent
119
119
//| to ``randrange(a, b + 1, 1)``"""
120
120
//| ...
@@ -129,7 +129,7 @@ STATIC mp_obj_t random_randint(mp_obj_t a_in, mp_obj_t b_in) {
129
129
}
130
130
STATIC MP_DEFINE_CONST_FUN_OBJ_2 (random_randint_obj , random_randint );
131
131
132
- //| def choice(seq: Any ) -> Any:
132
+ //| def choice(seq: list ) -> Any:
133
133
//| """Returns a randomly selected element from the given sequence. Raises
134
134
//| IndexError when the sequence is empty."""
135
135
//| ...
@@ -143,7 +143,7 @@ STATIC mp_obj_t random_choice(mp_obj_t seq) {
143
143
}
144
144
STATIC MP_DEFINE_CONST_FUN_OBJ_1 (random_choice_obj , random_choice );
145
145
146
- //| def random() -> Any :
146
+ //| def random() -> float :
147
147
//| """Returns a random float between 0 and 1.0."""
148
148
//| ...
149
149
//|
@@ -152,7 +152,7 @@ STATIC mp_obj_t random_random(void) {
152
152
}
153
153
STATIC MP_DEFINE_CONST_FUN_OBJ_0 (random_random_obj , random_random );
154
154
155
- //| def uniform(a: Any , b: Any ) -> Any :
155
+ //| def uniform(a: float , b: float ) -> float :
156
156
//| """Returns a random float between a and b. It may or may not be inclusive
157
157
//| depending on float rounding."""
158
158
//| ...
0 commit comments