With numpy you can easily create test data with random_integers and randint.
numpy.random.randint(low, high=None, size=None, dtype='l') numpy.random.random_integers(low, high=None, size=None)
random_integers includes the high boundary while randint does not.
>>> import numpy as np >>> np.random.random_integers(5) 4 >>> np.random.random_integers(5, size=(5)) array([5, 3, 4, 1, 4]) >>>np.random.random_integers(5, size=(5, 4)) array([[2, 3, 3, 5], [1, 3, 1, 3], [5, 3, 3, 4], [1, 5, 2, 5], [2, 5, 4, 5]])
If You want a random selection of choices from an array you can use
>>> import numpy as np >>> animals = ['dog', 'cat', 'rabbit'] >>> np.random.choice(animals, 9)) array(['dog', 'rabbit', 'dog', 'rabbit', 'dog', 'dog', 'cat', 'dog', 'cat'], dtype='|S6')