From 1596175f1e7d3db84aa31f2b5808628f0ca11e46 Mon Sep 17 00:00:00 2001 From: Jeffrey Lin Date: Mon, 20 Jan 2020 19:57:58 +0000 Subject: [PATCH] base/libc.jl: fix crash when run before epoch (#34056) (#34442) (cherry picked from commit f68753cc677676ef56dc3d9a78c415fbc8cff2b4) --- base/libc.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/libc.jl b/base/libc.jl index 7ed0e937fde09..379c76dfd8c60 100644 --- a/base/libc.jl +++ b/base/libc.jl @@ -398,6 +398,6 @@ rand(::Type{Float64}) = rand(UInt32) * 2.0^-32 Interface to the C `srand(seed)` function. """ -srand(seed=floor(time())) = ccall(:srand, Cvoid, (Cuint,), seed) +srand(seed=floor(Int, time()) % Cuint) = ccall(:srand, Cvoid, (Cuint,), seed) end # module