I looked and didn't find one that matched the semantics. And the case of 'stash this string in a file' comes up every time we want to invoke a compiler on generated text. I agree about rand(), but it was the least invasive choice for a minor case. As for security, this whole thing is essentially exec() and is massively insecure for a number of reasons.