Shop OBEX P1 Docs P2 Docs Learn Events
Random numbers — Parallax Forums

Random numbers

NewzedNewzed Posts: 2,503
edited 2004-12-01 00:49 in BASIC Stamp
I have been playing around with the RANDOM command for a few days, trying to come up with a long list of psuedo-random numbers without a major repitition.· I finally came up with a code that will give me 900 random numbers with no major sequential repeats.· There may be repeats of 2, 3 or even 4 numbers within the overall sequence - that is all.· The user enters a seed value to start and when 900 numbers have been generated, the program goes back to start and waits for a new seed.

I have attached the program in case anyone finds themseleves bored and has nothing else to do.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
New Combo LCD Backpack

http://hometown.aol.com/newzed/index.html

Comments

  • K de JongK de Jong Posts: 154
    edited 2004-11-30 23:37
    Hi Sid,

    This is a really interesting subject and you seem to have worked out quite al lot.

    The only big question I have how did you verify the randomness of your routine. Which methods did you use to do the checks and to optimize your routine?

    Regards,

    Klaus
  • NewzedNewzed Posts: 2,503
    edited 2004-12-01 00:05
    Hi, Klaus

    First, I used Hypertermimal to capture the data to Excel, then I kept graphing consecutive portions of the number list to see if I could see the same pattern.· Each graph looked like radon audio waves.

    Then I wrote:

    if div = 325 then
    debug dec div, "· ", dec result, cr

    After I finished changing and rechanging the program, I got to the point where each dec div produced a different dec result.· From this I assumed that there were no major repititions in the numerical sequence.

    Would you agree?

    Sid
  • K de JongK de Jong Posts: 154
    edited 2004-12-01 00:41
    Hi Sid,

    I don't know much about random numbers, I only know that it is very hard to generate really random numbers with a computer device. One of the problems is that after some numbers the sequence repeats in excactly the same form.

    It would be interesting to put your sequence into a loudspeaker, it then should sound like 'white noise' all frequencies being present at the same level. It should sound a bit like the sea.

    What are you going to do with these (pseudo) random numbers ??

    Klaus
  • NewzedNewzed Posts: 2,503
    edited 2004-12-01 00:49
    Klaus, I changed the seed every 225 numbers.· If there was a pattern in·each set of ·225 numbers I couldn't see it.

    What am I going to do with it?· Beats me - I was just boredrolleyes.gif

    Sid
Sign In or Register to comment.