Use linear congruential generator with seed value 31, a = 11, c = 17, m = 100 and inverse transform technique to generate:
#uniform u(1,10)
a=11;c=17;m=100;
n=10;seedx=31;
x=vector("numeric")
for (i in 1:n) {
x[i]=(a*seedx+c)%%m
seedx=x[i]
}
z=x/sum(x)
u=round(z*9,0)+1
u # uniform 1 to 10
#Exponential with lamda=3
exp.no<- function(n,lamda) {
if(lamda<=0 && n<=0)
{
print("wrong")
}
else
{
u=runif(n)
x=NULL
x1=NULL
for (i in 1:n) {
x=-lamda*log(1-u[i])
x1=append(x1,x,after = length(x))
}
}
return(x1)
}
a=exp.no(10,3) # exp(n=10,lamda=3)
#install.packages("randtests)
library(randtests)
randtests::runs.test(a,alternative = "two.sided")
Use linear congruential generator with seed value 31, a = 11, c = 17, m =...
Generate 10 random numbers using the following linear congruential generator with 7 as the seed: si+1 = (5 * si + 1) mod 20.
11. What sequence of pseudorandom numbers is generated using the linear congruential generator xn +1 (4xn + 1) mod 7 with seed Xo-37 12. Encrypt the message STOP POLLUTION by translating the letters into numbers, applying the encryption function/ P)-(p + 4) mod 26, and then translating the numbers back into letters. 13. Decrypt this message encrypted using the shift cipher f (p) (p+ 10) mod 26 CEBBOXNOBXYG 14. Let P() be the statement that 12 +22 ++n2 -n-)(en+2) for...