Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>EDIT:</strong> I just realized you were, probably, talking about multivariate Gaussian distribution. In this case, I think, you'd need <em>N</em> normal distributions, each corresponding to an univariate distribution along one of the coordinates. Then, you generate <strong>random vector</strong>'s coordinates by sampling each of the distributions. Effectively, the edited code below represents <em>coordinates of 10 two-dimensional <strong>random vectors</strong></em>, using C++11 pseudo-random number generation (<a href="http://ideone.com/3OWsra" rel="nofollow">code on ideone.com</a>). Note, in the example given there will be correlation between the two coordinates, since there is correlation between consecutive pseudo-random numbers. One can try using two seeds with two generators with more sophisticated algorithms provided by the Standard library. However, I feel, there still might be a correlation, even using two different generators - one would have to investigate this issue to give a definite answer. </p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include &lt;random&gt; #include &lt;iomanip&gt; int main() { std::random_device device_random_; std::default_random_engine generator_(device_random_()); std::normal_distribution&lt;&gt; distribution_x_(1.0, 0.5); std::normal_distribution&lt;&gt; distribution_y_(10.0, 1.0); std::vector&lt;double&gt; vector_x_, vector_y_; for (int counter_(0); counter_ &lt; 10; ++counter_) { vector_x_.push_back(distribution_x_(generator_)); vector_y_.push_back(distribution_y_(generator_)); std::cout &lt;&lt; std::fixed &lt;&lt; std::setprecision(4) &lt;&lt; "(" &lt;&lt; vector_x_[counter_] &lt;&lt; ", " &lt;&lt; vector_y_[counter_] &lt;&lt; ")\n"; } return (0); } </code></pre> <p>Program output:</p> <pre><code>(0.2390, 10.3887) (1.1087, 9.5847) (1.0920, 9.3468) (1.1982, 11.6633) (0.8840, 11.0903) (0.5573, 8.5121) (0.6709, 11.4706) (1.1477, 9.4374) (0.8778, 11.0323) (0.8255, 9.7704) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload