title: Using Boost skew_normal_distribution
body: <p>This has been addressed before (<a href="https://stackoverflow.com/questions/38185604/using-boosts-skewed-normal-distribution">Using boost&#39;s skewed_normal_distribution</a>) but I having difficulties and the previous thread didn't include any solution code.</p>
  
  <p>I would like to sample from a skewed normal distribution using the functions built into the Boost library</p>
  
  <p>I am adapting code that I know works fine with the <code>normal_distribution&lt;&gt;</code> class but when I run the code I keep getting the error shown below.  If anyone could help me with this I'd be very grateful.</p>
  
  <pre><code>#include &lt;boost/random.hpp&gt;
  #include &lt;boost/random/normal_distribution.hpp&gt;
  #include &lt;boost/math/distributions/skew_normal.hpp&gt;
  
  int main() {
  
  boost::mt19937 rng2;
  
  boost::math::skew_normal_distribution&lt;&gt; snd(0.0, 1.0, 1.0);
  
  boost::variate_generator&lt;boost::mt19937&amp;,
          boost::math::skew_normal_distribution&lt;&gt; &gt; var_snd(rng2, snd);
  
  int i = 0; for (; i &lt; 10; ++i)
  {
      double d = var_snd();
      std::cout &lt;&lt; d &lt;&lt; std::endl;
  }
  
  
      return 0;
  }
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>[ 50%] Building CXX object CMakeFiles/untitled.dir/main.cpp.o
  In file included from /usr/include/boost/random.hpp:55:0,
                   from /home/jack/CLionProjects/untitled/main.cpp:1:
  /usr/include/boost/random/variate_generator.hpp: In instantiation of ‘class boost::random::variate_generator&lt;boost::random::mersenne_twister_engine&lt;unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u&gt;&amp;, boost::math::skew_normal_distribution&lt;double&gt; &gt;’:
  /home/jack/CLionProjects/untitled/main.cpp:13:63:   required from here
  /usr/include/boost/random/variate_generator.hpp:59:48: error: no type named ‘result_type’ in ‘class boost::math::skew_normal_distribution&lt;double&gt;’
       typedef typename Distribution::result_type result_type;
  </code></pre>