MCPcopy Index your code
hub / github.com/geekcomputers/Python / randomVector

Function randomVector

linear-algebra-python/src/lib.py:241–252  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

239
240
241def randomVector(N, a, b):
242 """
243 input: size (N) of the vector.
244 random range (a,b)
245 output: returns a random vector of size N, with
246 random integer components between 'a' and 'b'.
247 """
248 ans = zeroVector(N)
249 random.seed(None)
250 for i in range(N):
251 ans.changeComponent(i, random.randint(a, b))
252 return ans
253
254
255class Matrix(object):

Callers

nothing calls this directly

Calls 2

zeroVectorFunction · 0.85
changeComponentMethod · 0.45

Tested by

no test coverage detected