I want to create a random number using n numbers which are between i and j. For instance, for n=10 and i=1 and j=5, such an output is expected: 2414243211
. I did it in R using this code:
paste(floor(runif(10,1,5)),collapse="") #runif create 10 random number between 1 and 5 and floor make them as integer and finally paste makes them as a sequence of numbers instead of array.
I want to do the same in Python. I found random.uniform
but it generates 1 number and I don't want to use loops.
import random
import math
math.floor(random.uniform(1,5)) #just generate 1 number between 1 and 5
Aucun commentaire:
Enregistrer un commentaire