I am trying to implement a simulated likelihood model for a stochastic differential equation in stan as described in Simulation and Inference for Stochastic Differential Equations (section 3.3.2).

The manual says normal_rng can only be used in generated quantities.

All I was able to find is this discussion back from 2012.

I could generate the necessary amount of random numbers in R and pass them in as data, although that would be less efficient due to serialization/deserialization of a large amount of data.

Is there a better way?

I understand the problem of the non-deterministic lp. What if the rng inside the model could be initialized with a fixed seed at the beginning of each leapfrog step? Then the lp would be deterministic and smooth.