File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 247247RAND_PATH=" $ROOT_DIR /Lib/Random.hpp"
248248if [[ -f " $RAND_PATH " ]]; then
249249 if grep -q " resetSeed" " $RAND_PATH " && ! grep -q " systemSeed" " $RAND_PATH " ; then
250- python - << PY
250+ RAND_PATH= " $RAND_PATH " python - << ' PY '
251251from pathlib import Path
252- path = Path(r"$RAND_PATH ")
252+ import os
253+ path = Path(os.environ["RAND_PATH"])
253254text = path.read_text()
254- insert = \"\"\" inline static unsigned systemSeed()\\ n {\\ n#ifdef __EMSCRIPTEN__\\ n try {\\ n return std::random_device()();\\ n } catch (...) {\\ n return static_cast<unsigned>(std::time(nullptr));\\ n }\\ n#else\\ n return std::random_device()();\\ n#endif\\ n }\\ n\\ n\"\"\"
255+ insert = (
256+ " inline static unsigned systemSeed()\\n"
257+ " {\\n"
258+ "#ifdef __EMSCRIPTEN__\\n"
259+ " try {\\n"
260+ " return std::random_device()();\\n"
261+ " } catch (...) {\\n"
262+ " return static_cast<unsigned>(std::time(nullptr));\\n"
263+ " }\\n"
264+ "#else\\n"
265+ " return std::random_device()();\\n"
266+ "#endif\\n"
267+ " }\\n\\n"
268+ )
255269old = " inline static void resetSeed ()\\n {\\n setSeed(std::random_device()());\\n }\\n"
256270new = " inline static void resetSeed ()\\n {\\n setSeed(systemSeed());\\n }\\n"
257271if old in text:
You can’t perform that action at this time.
0 commit comments