+ Reply to Thread
Results 1 to 3 of 3

Thread: Basic RNG Help

  1. #1
    Points: 1,109, Level: 18
    Level completed: 9%, Points required for next Level: 91

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Basic RNG Help




    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.

    I'm not familiar enough with R to really know what to look for. This is a school assignment so the guidelines are pretty set, but my professor is not willing to offer any help, so I'm using this as a last resort.
    Last edited by amyt_04; 02-03-2011 at 08:32 PM.

  2. #2
    Devorador de queso
    Points: 95,781, Level: 100
    Level completed: 0%, Points required for next Level: 0
    Awards:
    Posting AwardCommunity AwardDiscussion EnderFrequent Poster
    Dason's Avatar
    Location
    Tampa, FL
    Posts
    12,933
    Thanks
    307
    Thanked 2,629 Times in 2,245 Posts

    Re: Basic RNG Help

    What are you allowed to use? I think the main thing is that if you want to produce the same numbers each time you include something like
    Code: 
    set.seed(23512)
    where the seed number is whatever you want it to be. From there you could generate your numbers however you want. You said you can't use runif. How about rnorm?
    Code: 
    set.seed(23425)
    x <- rnorm(100000)
    randomnumbers <- pnorm(x)
    randomnumbers should contain a sample from a uniform distribution now.

    Or are you being asked to code your own random number generator using some algorithm? It's possible that that's what they're asking for. It's not too horrible to do but I haven't done it for a while...

  3. #3
    Points: 1,109, Level: 18
    Level completed: 9%, Points required for next Level: 91

    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Basic RNG Help


    My thoughts are that yes, he wants us to make an algorithm. He refuses to answers questions. All he said was you don't need a package and you don't need a function, or seed. So that is my thought. Someone suggested this

    x_n = (a * x_n-1 + b) mod c

    and I'm working to figure out exactly what that is.

+ Reply to Thread

           




Similar Threads

  1. very basic question
    By chicornio in forum Statistics
    Replies: 3
    Last Post: 02-16-2011, 04:19 PM
  2. Basic Probability 2
    By sukumartenth in forum Probability
    Replies: 6
    Last Post: 11-01-2010, 03:28 AM
  3. Help with basic proportions
    By brownclown in forum Probability
    Replies: 0
    Last Post: 10-11-2010, 08:02 PM
  4. Likely a very basic question
    By puzzle in forum Psychology Statistics
    Replies: 1
    Last Post: 01-31-2009, 08:51 PM
  5. basic probability
    By andrewink in forum Probability
    Replies: 1
    Last Post: 09-28-2008, 06:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts






Advertise on Talk Stats