Separating methods

getting data from database and generating random data now are separated
to two methods.