Replaced mktemp with alternative temp file generation based on secure randoms in order to avoid owner-restricted permission issues with mktemp files