I have encountered an odd behaviour running R (2.11.1) on a Ubuntu cluster using the "sun grid engine" 
 
In interactive sessions tempfile() behaves as expected but when  run in a batch job 
I always get the same filename from tempfile on different nodes and at different times
although I am setting the random number seed with the time. 
It appears that somehow it is not using the standard random number generator as .Random.seed
is unchanged. 
Has anyone any idea what is happening ?

Example below, different runs always return chkres327b23c6 followed by chkres643c9869
Ashley Ford

 
> setseedtime(JAi)
Setting seed with 1286368636 
> str(.Random.seed)
 int [1:626] 403 624 1782566087 524555868 -1794862163 601295498 -1455000957 -1816307224 1176094409 948265974 ...

> tempfile("chkres", ".")
[1] "./chkres327b23c6"
> tempfile("chkres", ".")
[1] "./chkres643c9869"
> str(.Random.seed)
 int [1:626] 403 624 1782566087 524555868 -1794862163 601295498 -1455000957 -1816307224 1176094409 948265974 ...
 
setseedtime is a utility to set the seed
> setseedtime
function(JAi=NA)
{ # set and report seed start, use id if multiple jobs at same time
rseed <- unclass(Sys.time())
if(!is.na(JAi))rseed <- rseed + as.integer(JAi)*321
cat("Setting seed with", rseed, "\n")
set.seed(rseed)
return(invisible(rseed))
}








	[[alternative HTML version deleted]]

