boost random in 2 dimensions

I am trying to use a boost random generator to make random points uniformly distributed over a plane surface. In the the following link, the code for doing it in a single dimension is available: http://stackoverflow.com/questions/2254909/boost-random-number-generator Here they use boost::uniform_int<> to generate numbers as int in a single dimension. But in my case I wish to generate numbers as float in two dimensions over a plane. Is there any distribution type available to use it in two dimensions? (I have seen boost::uniform_on_sphere, but it is for spherical surfaces.) Is it possible to to this using boost library? -- View this message in context: http://boost.2283326.n4.nabble.com/boost-random-in-2-dimensions-tp4641761.ht... Sent from the Boost - Users mailing list archive at Nabble.com.

To generate uniformly-distributed random points on a flat plane, just draw two uniformly-distributed floats for your two coordinates. You don't have to do anything special, which is why the library doesn't provide anything for this. The reason uniform_on_sphere exists is because that problem does not have a trivial solution. -Gabe

@Gabriel
From your answer I understand that, the uniform distributed values are generated seperately for x and y axis. Then both should be combined to form a point over a plane.
@Norbert i think this could do uniform distribution only over one co-ordinates. -- View this message in context: http://boost.2283326.n4.nabble.com/boost-random-in-2-dimensions-tp4641761p46... Sent from the Boost - Users mailing list archive at Nabble.com.

On 01/25/2013 05:57 PM, Danny wrote:
I am trying to use a boost random generator to make random points uniformly distributed over a plane surface. In the the following link, the code for doing it in a single dimension is available:
[...]
Is there any distribution type available to use it in two dimensions? (I have seen boost::uniform_on_sphere, but it is for spherical surfaces.)
In case of a plane, what speaks against using two uniformly distributed floats in range [0 1] as UV parameters in your plane? That should give uniformly distributed points in the plane, or am I missing something here? Norbert

i think this could do uniform distribution only over one co-ordinates. -- View this message in context: http://boost.2283326.n4.nabble.com/boost-random-in-2-dimensions-tp4641761p46... Sent from the Boost - Users mailing list archive at Nabble.com.

i think this could do uniform distribution only over one co-ordinates. -- View this message in context: http://boost.2283326.n4.nabble.com/boost-random-in-2-dimensions-tp4641761p46... Sent from the Boost - Users mailing list archive at Nabble.com.
participants (3)
-
Danny
-
Gabriel Redner
-
Norbert Wenzel