Skip to content

Instantly share code, notes, and snippets.

@jwscook
Created July 13, 2020 10:03
Show Gist options
  • Save jwscook/8df8ea24b421f23d7cc87269947d9339 to your computer and use it in GitHub Desktop.
Save jwscook/8df8ea24b421f23d7cc87269947d9339 to your computer and use it in GitHub Desktop.
using Random
const seed = hash(time())
Random.seed!(seed)
searchstring = "const seed = "
open("$(@__FILE__)" * ".reproducible", "w") do io
for line in readlines(open(@__FILE__))
if length(line) > length(searchstring) && line[1:length(searchstring)] == searchstring
write(io, searchstring * "$seed\n")
else
write(io, line * "\n")
end
end
end
@show seed
@show rand()
@jwscook
Copy link
Author

jwscook commented Jul 13, 2020

And ReproduceExample.jl.rerunnable is identical to ReproduceExample.jl.rerunnable.rerunnable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment