Suppose I have a loop where I generate samples with a stochastic function:

```
srand(2017)
for i=1:1000
sample = stochastic_function(deterministic_parameters...)
end
```

I need to save the state in order to be able to do some calculations later. That is, I need to be able to pass in the same deterministic parameters and get the same exact sample. What is the appropriate idiom in Julia for achieving this goal?