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,a,b)
| 177 | |
| 178 | |
| 179 | def randomVector(N,a,b): |
| 180 | """ |
| 181 | input: size (N) of the vector. |
| 182 | random range (a,b) |
| 183 | output: returns a random vector of size N, with |
| 184 | random integer components between 'a' and 'b'. |
| 185 | """ |
| 186 | random.seed(None) |
| 187 | ans = [random.randint(a,b) for i in range(N)] |
| 188 | return Vector(ans) |
| 189 | |
| 190 | |
| 191 | class Matrix(object): |