Dear Etienne,

You asked for 25 numbers out of 25 numbers, so they are all returned, in
cell-order. Perhaps that should be spelled out in the docs, for cases where
the order of the returned numbers matters.

Things are different when you ask for a subset:

> sampleRandom(r, 5)
[1] 10 23  9  7 19
> sampleRandom(r, 5)
[1] 18  8 13 24 22
>

Robert

On Thu, Feb 9, 2012 at 8:02 AM, Etienne B. Racine <etiennebr@gmail.com>wrote:

> It seems that sampleRandom isn't so random.
>
> # try this :
> library(raster)
> r <- raster(matrix(1:25, 5, 5))
> sampleRandom(r, 25)
> ## 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15
> sampleRandom(r, 25)
> ## 1 6 11 16 21 2 7 12 17 22 3 8 13 18 23 4 9 14 19 24 5 10 15
>
> I haven't seen any documentation about this behavior.
>
> Etienne
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

