rnorm2 <- function(n,mean,sd) { mean+sd*scale(rnorm(n)) } 

x <- rnorm2(100, 100, 10) 
y.error <- rnorm(100, 0, 4)
y <- 3*x + y.error
cor(x,y)