Home   Help Search Login Register  

Author Topic: Random selection in a circle - Maths Problem Revisited  (Read 1992 times)

0 Members and 1 Guest are viewing this topic.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:Random selection in a circle - Maths Problem Revisited
« Reply #15 on: 03 Sep 2005, 10:14:30 »
Plenty of reviewed ArmA missions for you to play

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Random selection in a circle - Maths Problem Revisited
« Reply #16 on: 03 Sep 2005, 10:53:36 »
 ;D
Okay that's enough.  It wasn't that funny.

Offline Triggerhappy

  • Contributing Member
  • **
  • Llama, it's what's for dinner.
Re:Random selection in a circle - Maths Problem Revisited
« Reply #17 on: 04 Sep 2005, 05:57:24 »
LOLOMFGROFLMFGDAOLOL

 ::)

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Random selection in a circle - Maths Problem Revisited
« Reply #18 on: 22 Sep 2005, 22:05:53 »
In my experience the random number generator is not sticky. Generate a large number, say 10000, of random numbers using random 1.  Count the number that fall in the range < 0.5 and the number that fall into range >=0.5

The two counts should be about equal each time you try this.  Now divide the range from 0-1 into 10 bins instead of 2.

With 10 bins I do not see a discernable pattern, no matter how many times I repeat the experiment.  Although the distribution is never perfectly uniform (i.e. 1000 counts for each bin), the distribution seems to have no repeatable pattern.  This is not a rigourous test, but is reassuring.  

I wrote a random number shuffler that is the first improvement on a linear congruent random number generator, and the results are not significantly different.  

These tests were run from within the mission editor.

I will rerun the test tonight with 1000000 random numbers and see what happens.  
urp!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Random selection in a circle - Maths Problem Revisited
« Reply #19 on: 22 Sep 2005, 23:18:13 »
Peanut.  I think we might be attributing different meanings to the word 'sticky'.  Your test - which is an excellent one, is checking for randomness of distribution.  By sticky I am really referring to a correlation between consecutive random numbers.  So that if one number is low the likelihood is that the next one will be low also.  That is what I mean by sticky.

I am sure there are many official statistical tests that could be done to check this, but I don't know them.  My gut feel is that if you test a lot of random numbers and don't put the numbers themselves into buckets, instead subtract each number from the one before and put that result into the correct bucket there should be an even spread across all buckets if it is not sticky, but a concentration of numbers close to 0 if the generator is sticky.  The range of answers should go from -1 to +1.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Random selection in a circle - Maths Problem Revisited
« Reply #20 on: 23 Sep 2005, 00:22:02 »
Looks like I might have to eat my words...distribution is not great. roughly 5% error....

Trial 1 - 101101,98593,98329,98495,100564,102888,101871,98091,98525,101543

THobson... If you are really concerned about correlation between sequential random numbers, I have written a function that corrects for this to some degree.  Perhaps I should submit it.

Function randomPlus submitted.
« Last Edit: 23 Sep 2005, 01:59:26 by Mr.Peanut »
urp!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Random selection in a circle - Maths Problem Revisited
« Reply #21 on: 24 Sep 2005, 11:40:13 »
I am not concerned, it is just that this is a phenomena I think I have noticed - so if someone was to do some tests I would be very interested in the results

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re:Random selection in a circle - Maths Problem Revisited
« Reply #22 on: 24 Sep 2005, 23:05:56 »
Well, try my new function sometime...
urp!

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Random selection in a circle - Maths Problem Revisited
« Reply #23 on: 25 Sep 2005, 22:09:03 »
I may well do that.  But I would like to investigate the problem, if it is a problem, first.

Well I think this thread has run its course.  It was intended simply to be a guide to selecting  points randomly and evenly within a circle.  It went on to deal with the randomness of random numbers and it is now time to solve it.

Thanks everyone.