I'm confused, how can it be random if it returns the same numbers each time.
Can you give us more detail?
I need to find a random number generator algorithm that will produce the SAME 100000 numbers each time from 0 to 1 on a uniform distribution, and it cannot be runif. I cannot download a package.
I'm new to this, and I've tried everything, sample(), rnorm(), random package. The list goes on and on. I've been working on this for about 20 hours over the past three days with no luck. All of them produce DIFFERENT random numbers, but I can't seem to find anything that produces the same ones.
My professor hasn't replied to my requests for help, so I'm using this as a last resort.
This is part of a large semester project for my statistics class.
I'm sort of confused as well but here is what the professor told us:
"Your question: Must our RNG have an even or close to even distribution? Does it need to guarantee randomness to a certain precision? Must it be inclusive of 0 and 1?
Answer:I do not want randomness with extreme precision or with period one billion. I want that your team knows how to generate the random in [0,1]. Hence, you can use a simple random number generator. For example, I easily found one one the web and I wrote in R without using any seed function; I knows if I repeat many times I get always the same numbers but here we want just show the basic idea."
Method 2: set up an array of 100000 elements, fill it with random numbers and use these in your program.
Lehmer random number generator - Wikipedia, the free encyclopedia
If you know how to write R code it shouldn't be difficult.
YES! This is what I needed. I do have a problem with this though. I made an empty vector that holds the 10000 values i need, and then used the for loop to move along the vector. A lot of these algorithms got to values of 40000000, or 2000000. Should I just divide the vector by 40000000 or 2000000 respectively to make sure its on [0,1], or is there a way to fix the constants so that it doesn't do that?
Thank you so much. I'm sorry for the confusion. This is the first time my professor has taught an undergrad class, and all his assignments are very ambiguous.
•Project #1 assignment 2–In lesson #3 we used the R function runif(1) to generate random numbers.–Hence, find a simple random number generator in [0,1].–Write a small script using R–Generate 10000 random numbers.–Plot the random numbers
Later on he said this:
You should not use R functions or libraries; you should look on the web for an algorithm about random number generators.
I used x(n+1)=a*x(n)*mod m