returns a random matrix WxH with integer components between 'a' and 'b'
(width: int, height: int, a: int, b: int)
| 433 | |
| 434 | |
| 435 | def random_matrix(width: int, height: int, a: int, b: int) -> Matrix: |
| 436 | """ |
| 437 | returns a random matrix WxH with integer components |
| 438 | between 'a' and 'b' |
| 439 | """ |
| 440 | random.seed(None) |
| 441 | matrix: list[list[float]] = [ |
| 442 | [random.randint(a, b) for _ in range(width)] for _ in range(height) |
| 443 | ] |
| 444 | return Matrix(matrix, width, height) |