This is not homework, just a learning exercise on my part. I have been running a very simple simulation (or number-crank) in R. It generates two numbers (A, B) and runs for 1 month.
A=NULL
B=NULL
x=NULL
x <- Sys.time()
duration <- 2592000 # 30 days
while(Sys.time() <= x + duration){
A <-append(A, sample(1:5, 1000, 1/5))
B <-append(B, sample(1:5, 1000, 1/5))
save.image()
}
I thought it was going well, but after one week (and several million numbers generated) the OS killed the process. Is there a better way of writing or running the simulation that would prevent the OS killing it?
I would prefer to rewrite the simulation than to adapt the OS (such as adding more swap etc). I am running the simulation on a low-powered device (Raspberry Pi) and am limited in what I can do on the hardware side. Thanks.
UPDATE:
1) It is not important that the samples be generated 1000 at a time. This was just my cludge.
2) It is important that the simulation runs for a set period of time ie 1 week, 1 month or 1 year.
3) Unless impossible I want the raw data.