title: Cannot get <random> library to work
body: <p>I'm having trouble getting the  library working on macosx.  First off, I tried to compile the following code, saved as rand.cpp, taken from the c++ website </p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;random&gt;
  
  int main()
  {
       const int nrolls=10000;  // number of experiments
       const int nstars=100;    // maximum number of stars to distribute
  
       std::default_random_engine generator;
       std::normal_distribution&lt;double&gt; distribution(5.0,2.0);
  
       int p[10]={};
  
       for (int i=0; i&lt;nrolls; ++i) {
           double number = distribution(generator);
           if ((number&gt;=0.0)&amp;&amp;(number&lt;10.0)) ++p[int(number)];
       }
  
       std::cout &lt;&lt; "normal_distribution (5.0,2.0):" &lt;&lt; std::endl;
  
       for (int i=0; i&lt;10; ++i) {
            std::cout &lt;&lt; i &lt;&lt; "-" &lt;&lt; (i+1) &lt;&lt; ": ";
            std::cout &lt;&lt; std::string(p[i]*nstars/nrolls,'*') &lt;&lt; std::endl;
       }
  
       return 0;
  }
  </code></pre>
  
  <p>Upon running this with <code>g++ rand.cpp -o rand</code> i get the following errors</p>
  
  <pre><code>rand.cpp:9: error: ‘default_random_engine’ is not a member of ‘std’
  rand.cpp:10: error: ‘normal_distribution’ is not a member of ‘std’
  </code></pre>
  
  <p>Searching around it seems to be suggested that the issue is the compiler, apparently thus library is only available to gcc11.  I found a way to update gcc using the macport package as shown here <a href="https://stackoverflow.com/questions/837992/update-gcc-on-osx">Update GCC on OSX</a> but I still don't know how to use this new compiler.  Running <code>g++ rand.cpp -o rand</code> returns the same errors even when I change the compiler with <code>sudo port select --set gcc gcc40</code> or <code>sudo port select --set gcc mp-gcc46</code>.  I also tried using <code>g++ -std=c++11 rand.cpp -o rand</code> which just returns</p>
  
  <pre><code>cc1plus: error: unrecognized command line option "-std=c++11"
  </code></pre>
  
  <p>Does anyone know what I am doing wrong?</p>