Commit e5a10ec7 authored by Daniel Barnett's avatar Daniel Barnett
Browse files

R implementation of CALGO 266 (+ remarks)

parent 0a670d37
alg266 <- function(a, b, y, nval = 5000, c1 = c(25, 25, 5), c2 = 2^26) {
multipliers <- c(25, 25, 5)
for (i in 1:nval) {
for (m in c1) {
y <- (m * y) %% c2
}
}
y / c2 * (b - a) + a
}
alg266(0, 1, 32767)
# Remarks
alg266(0, 1, 32767, c1 = 125, c2 = 2796203)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment