From 44e4bd4af1a11ec0ef90c1b4a4cf763918037b98 Mon Sep 17 00:00:00 2001
From: Dorian Stoll <dorian.stoll@uni-potsdam.de>
Date: Thu, 13 Jun 2024 07:07:50 +0200
Subject: [PATCH] rodinia-srad: julia: Switch to libc RNG

---
 src/benchmarks/rodinia-srad/julia/srad.jl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/benchmarks/rodinia-srad/julia/srad.jl b/src/benchmarks/rodinia-srad/julia/srad.jl
index ac063cef..5f01168b 100755
--- a/src/benchmarks/rodinia-srad/julia/srad.jl
+++ b/src/benchmarks/rodinia-srad/julia/srad.jl
@@ -3,6 +3,8 @@
 using Printf
 using Random
 
+const RAND_MAX::Float32 = 2147483647.0
+
 function usage()
     prog = basename(Base.source_path())
 #    println(STDERR,"Usage ",prog," <rows> <cols> <y1> <y2> <x1> <x2> <no. of threads><lamda> <no. of iter>")
@@ -55,7 +57,15 @@ function main(args)
 
     println("Randomizing the input matrix")
 
-    I = rand(Float32, rows, cols)
+    @ccall srand(7::Cint)::Cvoid
+
+    I::Matrix{Float32} = zeros(rows, cols)
+    for i in 1:size(I, 1)
+        for j in 1:size(I, 2)
+            I[i, j] = (@ccall rand()::Cint) / RAND_MAX
+        end
+    end
+
     J = exp.(I)
     c::Matrix{Float32} = zeros(rows,cols)
 
-- 
GitLab