Dear Deepika,
Hope you are doing great.
You can use sample function to generate random number between specified range.
For example:
x <- sample(1:10, 5, replace=T)
x
[1] 6 9 7 6 5
You need to generate one function which will generate all the specified range.
Hope that helps.
Happy learning :)