Importance Sampling within Stan

Thanks for the advice, I’ve been trying to implement the randomness as data as you say. Previous discussions indicate that rng functions are allowed in the transformed data block (Generating random numbers in the model), however according to the functions reference (21.1) they may only be used in the generated quantities block. Maybe this restriction is part of a more recent update?