input: size (N) of the vector. random range (a,b) output: returns a random vector of size N, with random integer components between 'a' and 'b'.
(n: int, a: int, b: int)
| 229 | |
| 230 | |
| 231 | def random_vector(n: int, a: int, b: int) -> Vector: |
| 232 | """ |
| 233 | input: size (N) of the vector. |
| 234 | random range (a,b) |
| 235 | output: returns a random vector of size N, with |
| 236 | random integer components between 'a' and 'b'. |
| 237 | """ |
| 238 | random.seed(None) |
| 239 | ans = [random.randint(a, b) for _ in range(n)] |
| 240 | return Vector(ans) |
| 241 | |
| 242 | |
| 243 | class Matrix: |