**Generating the parameter v, a skewed random distribution (Weibull). **

In Matlab:

http://www.taygeta.com/random/weibull.xml

we read that:

WeibullRandomNumbers = scale.*( -log(1-rand(noOfRandomNumbers,1))).^(1/shape)

at the web page listed above it is explained that to use the weibull distibution first we need to generate a random number, x, which comes from a uniform distribution (in the range from 0 to 1).

This is very easy, we just use runif for one number, accepting the defaults, which

returns what we want, a random number between 0 and 1

**x <-runif(1)**

**x**

OK, here’s how it worked in R:

#begin random block

** x <-runif(862099)** #because there are 862099 cells in the map

** weibull <- 1+(-log(1-(x)))*exp(1/2)**

** funselect <- function(x) { x[x!=0] <- NA; return(x) }** #extract only vacant areas (value 0) so that existing functional land uses are not randomized. Set everything else to NA

**vacants <- calc(T1, funselect) ** #NEED TO TAKE VACANTS FROM T1

** random <- lu56** #just copying lu56 as a skeleton map

**values(random)<-weibull**

** model_random <- mask(random, vacants)** #generating a mask to apply NAs to the random layer.

**model_random <- cover(model_random,T1)** #cover to fill the NAs back in with the original values from T1.

#end random block

#———————–

And this is what the random map looks like (zoomed in around Sanlúcar de Barrameda. Existing urban areas take value “1”, so the random map is only applied to areas that are not already urban.