generate unlimited random numbers for fixed time

hey i want to generate random numbers for 1 hr eg runif(2,2,10) will generate fixed 2 number between 2 and 10 what i want to generate as many numbers for untill 1 hr is completed is there any function or package? please guide

Here is a very simple and probably inefficient way to do something like that. I only ran the code for three seconds and got 3.1 million values occupying 24Mb. If you generate the random numbers in blocks bigger than 10000, you will probably get even more values.

Out of curiosity, why do you want to do this?

Start <- Sys.time()
OUT <- vector(mode = "numeric")
while (Sys.time() - Start < 3) { #run for 3 seconds
  OUT <- c(OUT, runif(10000, 0, 10))
}

1 Like

how i can add delay of 5 minutes in generation of 5 random number

following error is generating while posting reprex please solve this issue
"Sorry you cannot post a link to that host."

To generate five random numbers with a five minute delay between each, you could do something like this.

OUT <- vector(mode = "numeric", length = 5)
for (i in 1:5) { 
  OUT[i] <- runif(1, 0, 10)
  Sys.sleep(300) #Wait 300s
}

Sorry, I cannot help with the reprex problem. I have never seen that error.