Created
July 28, 2022 13:42
-
-
Save SpringMT/a5429ebcfd269186f381fc025dca6212 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'gr/plot' | |
srand(1234) | |
res = [] | |
500.times.each do |i| | |
res << rand(10000) | |
end | |
x_res = [] | |
y_res = [] | |
z_res = [] | |
res.each_cons(3) do |x, y, z| | |
x_res << x | |
y_res << y | |
z_res << z | |
end | |
GR.scatter3(x_res, y_res, z_res, title: "spectral test") | |
GR.savefig("figure1.jpg") | |
R_A = 137 | |
R_C = 187 | |
R_M = 256 | |
R_SEED = 1234 | |
r = R_SEED | |
res2 = [] | |
500.times.each do |i| | |
new_r = (R_A * r + R_C) % R_M | |
res2 << new_r | |
r = new_r | |
end | |
x2_res = [] | |
y2_res = [] | |
z2_res = [] | |
res2.each_cons(3) do |x, y, z| | |
x2_res << x | |
y2_res << y | |
z2_res << z | |
end | |
GR.scatter3(x2_res, y2_res, z2_res, title: "LCG spectral test") | |
GR.savefig("figure2.jpg") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment