diff --git a/deps/src/singular.cpp b/deps/src/singular.cpp index 3f00e800a..993ec0f53 100644 --- a/deps/src/singular.cpp +++ b/deps/src/singular.cpp @@ -229,6 +229,20 @@ JLCXX_MODULE define_julia_module(jlcxx::Module & Singular) return old_mu; }); + Singular.method("set_randomseed", [](int m) { + int old_m=siSeed; + if (m != 0) + { + siSeed=m; + factoryseed(m); + } + return old_m; + }); + + Singular.method("random", []() { + return siRand(); + }); + singular_define_coeffs(Singular); singular_define_rings(Singular); singular_define_ideals(Singular); diff --git a/test/caller-test.jl b/test/caller-test.jl index cf6b9e44c..03e965e95 100644 --- a/test/caller-test.jl +++ b/test/caller-test.jl @@ -243,3 +243,9 @@ end GC.gc(true) @test length(string(a)) > 2 end + +@testset "random" begin + Singular.libSingular.set_randomseed(1) + @test Singular.libSingular.random() == 16807 + @test Singular.libSingular.random() == 282475249 +end