- #1

Abzu

- 7

- 0

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter Abzu
- Start date

- #1

Abzu

- 7

- 0

- #2

mrbohn1

- 97

- 0

picking 3 random numbers between 0 and 1 for the x,y and z coordinates sounds like a better bet...

- #3

Mark44

Mentor

- 36,334

- 8,293

picking 3 random numbers between 0 and 1 for the x,y and z coordinates sounds like a better bet...

Almost all of the time, this would give you a point

- #4

mrbohn1

- 97

- 0

- #5

- 15,450

- 687

A good random number package will provide separate interfaces for drawing from U[0,1), U[0,1], U(0,1), and U(0,1]. A not so good one might only provide just one of these four. There are some very small drawbacks to using not quite the right interface. For example, drawing longitude from U[0,360º] gives a small chance of doubling up on 0 versus 360º. Drawing sine(latitude) from U[-1,1) means you ruled out the North Pole.

- #6

Abzu

- 7

- 0

A good random number package will provide separate interfaces for drawing from U[0,1), U[0,1], U(0,1), and U(0,1]. A not so good one might only provide just one of these four. There are some very small drawbacks to using not quite the right interface. For example, drawing longitude from U[0,360º] gives a small chance of doubling up on 0 versus 360º. Drawing sine(latitude) from U[-1,1) means you ruled out the North Pole.

Uhm, i have absolutely no idea what this means. I only know very basic math. And in case i was unclear in my first post, i want an even distribution,

- #7

Abzu

- 7

- 0

- #8

- 15,450

- 687

I'll keep it simple -- after saying what U(a,b) and the related terms mean. Colloquially, U(a,b) means "a random number drawn from between

So, what does this mean? Draw a random number from between -1 and 1. Take the inverse sine of this number and express the result in degrees. This is your latitude. Draw a random number from between 0 and 360º. This is your longitude. If you draw a whole bunch of latitude,longitude pairs this way and plot their locations you will see that this gives a nice uniform spread over the globe. As you have already discovered, drawing latitude directly from between -90º and 90º does not give a nice uniform spread.

- #9

Abzu

- 7

- 0

=ASIN((RANDBETWEEN(-1000;1000)/1000))/PI()*180

Thanks D H!

- #10

- 15,450

- 687

BTW, =DEGREES(ASIN(RAND()*2-1)) would work quite nicely as well.

My version of Excel doesn't even have a RANDBETWEEN function.

- #11

uart

Science Advisor

- 2,797

- 21

I know this is probably not much help to the OP, but it’s interesting to point out that DH’s method is mathematically equivalent to choosing latitude from a random distribution with a cosine probability density function,

[tex]f(\phi) = 1/2 \cos(\phi) \, : \, -\pi/2 \leq \phi \leq \pi/2[/tex]

Since an element of surface on the sphere is (taking phi as latitude and theta as longitude) given by :

[tex]dS/r^2 = \cos(\phi) \, d\phi \, d\theta[/tex]

and [itex]\cos(\phi) d\phi[/itex] is (for the given pdf) proportional to the probability that latitude is between [itex]\phi[/itex] and [itex]\phi + d\phi[/itex] then it follows that the probability of "hitting" a given element of surface on the sphere is proportional only to the SA of the element, no matter where that element of SA is located.

[tex]f(\phi) = 1/2 \cos(\phi) \, : \, -\pi/2 \leq \phi \leq \pi/2[/tex]

Since an element of surface on the sphere is (taking phi as latitude and theta as longitude) given by :

[tex]dS/r^2 = \cos(\phi) \, d\phi \, d\theta[/tex]

and [itex]\cos(\phi) d\phi[/itex] is (for the given pdf) proportional to the probability that latitude is between [itex]\phi[/itex] and [itex]\phi + d\phi[/itex] then it follows that the probability of "hitting" a given element of surface on the sphere is proportional only to the SA of the element, no matter where that element of SA is located.

Last edited:

- #12

mikeph

- 1,235

- 18

No polar bias doing it this way, though you need 3 random numbers per point rather than the minimum 2.

- #13

- 15,450

- 687

In the vicinity of the projections onto the sphere of areas in the vicinity of

- The centers of the six faces of the cube: Too few points.
- The twelve edges of the cube: Too many points.
- The eight corners of the cube: Way too many points.

- #14

mikeph

- 1,235

- 18

Ok I see, I had it very confused. Disregard my first post!

- #15

- 15,450

- 687

Your approach can be made to work. Reject

Share:

- Last Post

- Replies
- 1

- Views
- 484

- Replies
- 26

- Views
- 419

- Last Post

- Replies
- 22

- Views
- 1K

- Replies
- 3

- Views
- 533

- Last Post

- Replies
- 3

- Views
- 725

- Last Post

- Replies
- 16

- Views
- 2K

- Last Post

- Replies
- 1

- Views
- 661

- Last Post

- Replies
- 4

- Views
- 538

- Replies
- 1

- Views
- 473

- Last Post

- Replies
- 2

- Views
- 601