I thought if I used set.seed()
inside a function then every time I ran that function the same seed would be used and I would get the same quasi random output. Take the following example:
my_fun <- function(n, v1, v2){
set.seed = 42
return(runif(n, v1, v2))
}
my_fun(1,2,3)
#> [1] 2.078126
my_fun(1,2,3)
#> [1] 2.918556
my_fun(1,2,3)
#> [1] 2.189768
I was expecting to get the same result every time I ran that function with the same inputs. Can you give me some education on why I don't?