[Numpy-svn] r3582 - trunk/numpy/random/mtrand

numpy-svn@scip... numpy-svn@scip...
Mon Mar 19 12:19:50 CDT 2007


Author: oliphant
Date: 2007-03-19 12:19:39 -0500 (Mon, 19 Mar 2007)
New Revision: 3582

Modified:
   trunk/numpy/random/mtrand/Python.pxi
   trunk/numpy/random/mtrand/mtrand.c
   trunk/numpy/random/mtrand/mtrand.pyx
Log:
Make random number generators faster for scalar parameters.

Modified: trunk/numpy/random/mtrand/Python.pxi
===================================================================
--- trunk/numpy/random/mtrand/Python.pxi	2007-03-16 12:53:05 UTC (rev 3581)
+++ trunk/numpy/random/mtrand/Python.pxi	2007-03-19 17:19:39 UTC (rev 3582)
@@ -10,9 +10,13 @@
 
     # String API
     char* PyString_AsString(object string)
+    char* PyString_AS_STRING(object string)
     object PyString_FromString(char* c_string)
     object PyString_FromStringAndSize(char* c_string, int length)
 
+    # Float API
+    double PyFloat_AsDouble(object ob)
+
     # Memory API
     void* PyMem_Malloc(size_t n)
     void* PyMem_Realloc(void* buf, size_t n)
@@ -32,8 +36,16 @@
         destructor2 destr)
     void* PyCObject_AsVoidPtr(object self)
     void* PyCObject_GetDesc(object self)
-    int PyCObject_SetVoidPtr(object self, void* cobj)
-   
+    int PyCObject_SetVoidPtr(object self, void* cobj)  
+
+    # TypeCheck API
+    int PyFloat_Check(object obj)
+    int PyInt_Check(object obj)
+
+    # Error API
+    int PyErr_Occurred()
+    void PyErr_Clear()
+ 
 cdef extern from "string.h":
     void *memcpy(void *s1, void *s2, int n)
 

Modified: trunk/numpy/random/mtrand/mtrand.c
===================================================================
--- trunk/numpy/random/mtrand/mtrand.c	2007-03-16 12:53:05 UTC (rev 3581)
+++ trunk/numpy/random/mtrand/mtrand.c	2007-03-19 17:19:39 UTC (rev 3582)
@@ -1,4 +1,4 @@
-/* Generated by Pyrex 0.9.5.1a on Thu Feb  1 14:12:28 2007 */
+/* Generated by Pyrex 0.9.5.1 on Sat Mar 17 23:42:27 2007 */
 
 #include "Python.h"
 #include "structmember.h"
@@ -124,12 +124,18 @@
 static PyObject *__pyx_k59;
 static PyObject *__pyx_k60;
 static PyObject *(__pyx_f_6mtrand_cont0_array(rk_state (*),double ((*)(rk_state (*))),PyObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_cont1_array_sc(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_cont1_array(rk_state (*),double ((*)(rk_state (*),double )),PyObject *,PyArrayObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_cont2_array_sc(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,double ,double )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_cont2_array(rk_state (*),double ((*)(rk_state (*),double ,double )),PyObject *,PyArrayObject *,PyArrayObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_cont3_array_sc(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,double ,double ,double )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_cont3_array(rk_state (*),double ((*)(rk_state (*),double ,double ,double )),PyObject *,PyArrayObject *,PyArrayObject *,PyArrayObject *)); /*proto*/
 static PyObject *(__pyx_f_6mtrand_disc0_array(rk_state (*),long ((*)(rk_state (*))),PyObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_discnp_array_sc(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,long ,double )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_discnp_array(rk_state (*),long ((*)(rk_state (*),long ,double )),PyObject *,PyArrayObject *,PyArrayObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_discnmN_array_sc(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,long ,long ,long )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_discnmN_array(rk_state (*),long ((*)(rk_state (*),long ,long ,long )),PyObject *,PyArrayObject *,PyArrayObject *,PyArrayObject *)); /*proto*/
+static PyObject *(__pyx_f_6mtrand_discd_array_sc(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,double )); /*proto*/
 static PyObject *(__pyx_f_6mtrand_discd_array(rk_state (*),long ((*)(rk_state (*),double )),PyObject *,PyArrayObject *)); /*proto*/
 static double (__pyx_f_6mtrand_kahan_sum(double (*),long )); /*proto*/
 
@@ -270,6 +276,88 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_n_Float64;
+
+static PyObject *__pyx_f_6mtrand_cont1_array_sc(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {
+  double (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":146 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":147 */
+    __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":149 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":150 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":151 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":152 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":153 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":154 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.cont1_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_n_ValueError;
 
 static PyObject *__pyx_k61p;
@@ -284,7 +372,6 @@
   npy_intp __pyx_v_i;
   PyArrayIterObject *__pyx_v_itera;
   PyArrayMultiIterObject *__pyx_v_multi;
-  int __pyx_v_scalar;
   PyObject *__pyx_r;
   int __pyx_1;
   PyObject *__pyx_2 = 0;
@@ -297,87 +384,56 @@
   __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":149 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":150 */
-  __pyx_1 = (__pyx_v_oa->nd == 0);
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":151 */
-    __pyx_v_oa_data = ((double (*))__pyx_v_oa->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":152 */
-    __pyx_v_scalar = 1;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":154 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":165 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":155 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":166 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":156 */
-      __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":167 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":158 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":168 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":159 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":169 */
+    __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_itera));
+    __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":160 */
-      __pyx_v_array_data = ((double (*))arrayObject->data);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":170 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":161 */
-      __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_itera));
-      __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":171 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double (*))__pyx_v_itera->dataptr)[0]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":162 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":163 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double (*))__pyx_v_itera->dataptr)[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":164 */
-        PyArray_ITER_NEXT(__pyx_v_itera);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":172 */
+      PyArray_ITER_NEXT(__pyx_v_itera);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":166 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
-    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":174 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
-    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
     __pyx_4 = 0;
-    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
@@ -385,71 +441,52 @@
     arrayObject = ((PyArrayObject *)__pyx_4);
     Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":167 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":175 */
     __pyx_v_array_data = ((double (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":168 */
-    __pyx_1 = __pyx_v_scalar;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":176 */
+    __pyx_3 = PyArray_MultiIterNew(2,((void (*))arrayObject),((void (*))__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":178 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
     if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":169 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
-
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":170 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":171 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":179 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
+      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
+      Py_INCREF(__pyx_k61p);
+      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k61p);
+      __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":173 */
-      __pyx_3 = PyArray_MultiIterNew(2,((void (*))arrayObject),((void (*))__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
-      Py_DECREF(__pyx_3); __pyx_3 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":180 */
+    __pyx_5 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":175 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":181 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":176 */
-        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
-        __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
-        Py_INCREF(__pyx_k61p);
-        PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k61p);
-        __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        __Pyx_Raise(__pyx_3, 0, 0);
-        Py_DECREF(__pyx_3); __pyx_3 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":182 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":177 */
-      __pyx_5 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":178 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":179 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":180 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":183 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":181 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":184 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -471,6 +508,86 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_f_6mtrand_cont2_array_sc(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b) {
+  double (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":193 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":194 */
+    __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":196 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":197 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":198 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":199 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":200 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":201 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.cont2_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_k62p;
 
 static char (__pyx_k62[]) = "size is not compatible with inputs";
@@ -480,10 +597,8 @@
   double (*__pyx_v_oa_data);
   double (*__pyx_v_ob_data);
   PyArrayObject *arrayObject;
-  npy_intp __pyx_v_length;
   npy_intp __pyx_v_i;
   PyArrayMultiIterObject *__pyx_v_multi;
-  int __pyx_v_scalar;
   PyObject *__pyx_r;
   int __pyx_1;
   PyObject *__pyx_2 = 0;
@@ -496,97 +611,60 @@
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":194 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":195 */
-  __pyx_1 = (__pyx_v_oa->nd == 0);
-  if (__pyx_1) {
-    __pyx_1 = (__pyx_v_ob->nd == 0);
-  }
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":196 */
-    __pyx_v_oa_data = ((double (*))__pyx_v_oa->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":197 */
-    __pyx_v_ob_data = ((double (*))__pyx_v_ob->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":198 */
-    __pyx_v_scalar = 1;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":200 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":214 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":201 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":215 */
+    __pyx_2 = PyArray_MultiIterNew(2,((void (*))__pyx_v_oa),((void (*))__pyx_v_ob)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":202 */
-      __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":216 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":204 */
-      __pyx_2 = PyArray_MultiIterNew(2,((void (*))__pyx_v_oa),((void (*))__pyx_v_ob)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":217 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":205 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":218 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":206 */
-      __pyx_v_array_data = ((double (*))arrayObject->data);
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":219 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":207 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":220 */
+      __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":208 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":221 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":209 */
-        __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":210 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":211 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":222 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":213 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
-    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":224 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
-    __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
+    __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
     __pyx_5 = 0;
-    __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; goto __pyx_L1;}
+    __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
@@ -594,77 +672,58 @@
     arrayObject = ((PyArrayObject *)__pyx_5);
     Py_DECREF(__pyx_5); __pyx_5 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":214 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":225 */
     __pyx_v_array_data = ((double (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":215 */
-    __pyx_1 = __pyx_v_scalar;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":226 */
+    __pyx_4 = PyArray_MultiIterNew(3,((void (*))arrayObject),((void (*))__pyx_v_oa),((void (*))__pyx_v_ob)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":227 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
     if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":216 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
-
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":217 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":218 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":228 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+      __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+      Py_INCREF(__pyx_k62p);
+      PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k62p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_5); __pyx_5 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":220 */
-      __pyx_4 = PyArray_MultiIterNew(3,((void (*))arrayObject),((void (*))__pyx_v_oa),((void (*))__pyx_v_ob)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
-      Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":229 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":221 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":230 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":222 */
-        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
-        __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
-        Py_INCREF(__pyx_k62p);
-        PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k62p);
-        __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        Py_DECREF(__pyx_5); __pyx_5 = 0;
-        __Pyx_Raise(__pyx_4, 0, 0);
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":231 */
+      __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":223 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":232 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":224 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":233 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":225 */
-        __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":226 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":227 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":228 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":234 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":229 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":235 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -686,6 +745,86 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_f_6mtrand_cont3_array_sc(rk_state (*__pyx_v_state),double ((*__pyx_v_func)(rk_state (*),double ,double ,double )),PyObject *__pyx_v_size,double __pyx_v_a,double __pyx_v_b,double __pyx_v_c) {
+  double (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":245 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":246 */
+    __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":248 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Float64); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":249 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":250 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":251 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":252 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a,__pyx_v_b,__pyx_v_c);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":253 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.cont3_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_k63p;
 
 static char (__pyx_k63[]) = "size is not compatible with inputs";
@@ -696,10 +835,8 @@
   double (*__pyx_v_ob_data);
   double (*__pyx_v_oc_data);
   PyArrayObject *arrayObject;
-  npy_intp __pyx_v_length;
   npy_intp __pyx_v_i;
   PyArrayMultiIterObject *__pyx_v_multi;
-  int __pyx_v_scalar;
   PyObject *__pyx_r;
   int __pyx_1;
   PyObject *__pyx_2 = 0;
@@ -713,106 +850,63 @@
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":244 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":245 */
-  __pyx_1 = (__pyx_v_oa->nd == 0);
-  if (__pyx_1) {
-    __pyx_1 = (__pyx_v_ob->nd == 0);
-    if (__pyx_1) {
-      __pyx_1 = (__pyx_v_oc->nd == 0);
-    }
-  }
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":246 */
-    __pyx_v_oa_data = ((double (*))__pyx_v_oa->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":247 */
-    __pyx_v_ob_data = ((double (*))__pyx_v_ob->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":248 */
-    __pyx_v_oc_data = ((double (*))__pyx_v_oc->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":249 */
-    __pyx_v_scalar = 1;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":251 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":267 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":252 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":268 */
+    __pyx_2 = PyArray_MultiIterNew(3,((void (*))__pyx_v_oa),((void (*))__pyx_v_ob),((void (*))__pyx_v_oc)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":253 */
-      __pyx_2 = PyFloat_FromDouble(__pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":269 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":255 */
-      __pyx_2 = PyArray_MultiIterNew(3,((void (*))__pyx_v_oa),((void (*))__pyx_v_ob),((void (*))__pyx_v_oc)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":270 */
+    __pyx_v_array_data = ((double (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":256 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_DOUBLE); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":271 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":257 */
-      __pyx_v_array_data = ((double (*))arrayObject->data);
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":272 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":258 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":273 */
+      __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":259 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":274 */
+      __pyx_v_oc_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":260 */
-        __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":275 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":261 */
-        __pyx_v_oc_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":262 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":263 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":276 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":265 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
-    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":278 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
-    __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
+    __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_float64); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
     __pyx_5 = 0;
-    __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+    __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_5)));
@@ -820,77 +914,58 @@
     arrayObject = ((PyArrayObject *)__pyx_5);
     Py_DECREF(__pyx_5); __pyx_5 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":266 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":279 */
     __pyx_v_array_data = ((double (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":267 */
-    __pyx_1 = __pyx_v_scalar;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":280 */
+    __pyx_4 = PyArray_MultiIterNew(4,((void (*))arrayObject),((void (*))__pyx_v_oa),((void (*))__pyx_v_ob),((void (*))__pyx_v_oc)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":282 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
     if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":268 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
-
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":269 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":270 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":283 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
+      __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
+      Py_INCREF(__pyx_k63p);
+      PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k63p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_5); __pyx_5 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":272 */
-      __pyx_4 = PyArray_MultiIterNew(4,((void (*))arrayObject),((void (*))__pyx_v_oa),((void (*))__pyx_v_ob),((void (*))__pyx_v_oc)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
-      Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":284 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":274 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":285 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":275 */
-        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
-        __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
-        Py_INCREF(__pyx_k63p);
-        PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k63p);
-        __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        Py_DECREF(__pyx_5); __pyx_5 = 0;
-        __Pyx_Raise(__pyx_4, 0, 0);
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":286 */
+      __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":276 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":287 */
+      __pyx_v_oc_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,3));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":277 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":288 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":278 */
-        __pyx_v_ob_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":279 */
-        __pyx_v_oc_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,3));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":280 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]),(__pyx_v_ob_data[0]),(__pyx_v_oc_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":281 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":289 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":282 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":290 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -928,12 +1003,12 @@
   Py_INCREF(__pyx_v_size);
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":290 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":298 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":291 */
-    __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":299 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; goto __pyx_L1;}
     __pyx_r = __pyx_2;
     __pyx_2 = 0;
     goto __pyx_L0;
@@ -941,17 +1016,17 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":293 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
-    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":301 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
@@ -959,20 +1034,20 @@
     arrayObject = ((PyArrayObject *)__pyx_2);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":294 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":302 */
     __pyx_v_length = PyArray_SIZE(arrayObject);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":295 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":303 */
     __pyx_v_array_data = ((long (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":296 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":304 */
     for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":297 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":305 */
       (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state);
     }
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":298 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":306 */
     Py_INCREF(((PyObject *)arrayObject));
     __pyx_r = ((PyObject *)arrayObject);
     goto __pyx_L0;
@@ -993,6 +1068,88 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_n_Int;
+
+static PyObject *__pyx_f_6mtrand_discnp_array_sc(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,long __pyx_v_n,double __pyx_v_p) {
+  long (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":314 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":315 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":317 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":318 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":319 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":320 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":321 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_p);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":322 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.discnp_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_k64p;
 
 static char (__pyx_k64[]) = "size is not compatible with inputs";
@@ -1000,11 +1157,9 @@
 static PyObject *__pyx_f_6mtrand_discnp_array(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,double )),PyObject *__pyx_v_size,PyArrayObject *__pyx_v_on,PyArrayObject *__pyx_v_op) {
   long (*__pyx_v_array_data);
   PyArrayObject *arrayObject;
-  npy_intp __pyx_v_length;
   npy_intp __pyx_v_i;
   double (*__pyx_v_op_data);
   long (*__pyx_v_on_data);
-  int __pyx_v_scalar;
   PyArrayMultiIterObject *__pyx_v_multi;
   PyObject *__pyx_r;
   int __pyx_1;
@@ -1018,95 +1173,58 @@
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":310 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":311 */
-  __pyx_1 = (__pyx_v_on->nd == 0);
-  if (__pyx_1) {
-    __pyx_1 = (__pyx_v_op->nd == 0);
-  }
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":312 */
-    __pyx_v_on_data = ((long (*))__pyx_v_on->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":313 */
-    __pyx_v_op_data = ((double (*))__pyx_v_op->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":314 */
-    __pyx_v_scalar = 1;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":316 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":333 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":317 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":334 */
+    __pyx_2 = PyArray_MultiIterNew(2,((void (*))__pyx_v_on),((void (*))__pyx_v_op)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":318 */
-      __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":335 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":320 */
-      __pyx_2 = PyArray_MultiIterNew(2,((void (*))__pyx_v_on),((void (*))__pyx_v_op)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 320; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":336 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":321 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":337 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":322 */
-      __pyx_v_array_data = ((long (*))arrayObject->data);
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":338 */
+      __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":323 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":339 */
+      __pyx_v_op_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":324 */
-        __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":340 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":325 */
-        __pyx_v_op_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":326 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":327 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":341 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":329 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
-    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":343 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
-    __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
@@ -1114,77 +1232,58 @@
     arrayObject = ((PyArrayObject *)__pyx_2);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":330 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":344 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":331 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":345 */
+    __pyx_4 = PyArray_MultiIterNew(3,((void (*))arrayObject),((void (*))__pyx_v_on),((void (*))__pyx_v_op)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":332 */
-      __pyx_v_array_data = ((long (*))arrayObject->data);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":346 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
+    if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":333 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":334 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":347 */
+      __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;}
+      Py_INCREF(__pyx_k64p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k64p);
+      __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;}
+      Py_DECREF(__pyx_5); __pyx_5 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":336 */
-      __pyx_4 = PyArray_MultiIterNew(3,((void (*))arrayObject),((void (*))__pyx_v_on),((void (*))__pyx_v_op)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
-      Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":348 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":337 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":349 */
+      __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":338 */
-        __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
-        __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
-        Py_INCREF(__pyx_k64p);
-        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k64p);
-        __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
-        Py_DECREF(__pyx_5); __pyx_5 = 0;
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __Pyx_Raise(__pyx_4, 0, 0);
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":350 */
+      __pyx_v_op_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":339 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":351 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":340 */
-        __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":352 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":341 */
-        __pyx_v_op_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":342 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_op_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":343 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":344 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":353 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,2);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":346 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":355 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -1206,6 +1305,86 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_f_6mtrand_discnmN_array_sc(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),long ,long ,long )),PyObject *__pyx_v_size,long __pyx_v_n,long __pyx_v_m,long __pyx_v_N) {
+  long (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":364 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":365 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":367 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":368 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":369 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":370 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":371 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_n,__pyx_v_m,__pyx_v_N);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":372 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.discnmN_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_k65p;
 
 static char (__pyx_k65[]) = "size is not compatible with inputs";
@@ -1216,10 +1395,8 @@
   long (*__pyx_v_om_data);
   long (*__pyx_v_oN_data);
   PyArrayObject *arrayObject;
-  npy_intp __pyx_v_length;
   npy_intp __pyx_v_i;
   PyArrayMultiIterObject *__pyx_v_multi;
-  int __pyx_v_scalar;
   PyObject *__pyx_r;
   int __pyx_1;
   PyObject *__pyx_2 = 0;
@@ -1233,104 +1410,61 @@
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":360 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":361 */
-  __pyx_1 = (__pyx_v_on->nd == 0);
-  if (__pyx_1) {
-    __pyx_1 = (__pyx_v_om->nd == 0);
-    if (__pyx_1) {
-      __pyx_1 = (__pyx_v_oN->nd == 0);
-    }
-  }
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":362 */
-    __pyx_v_scalar = 1;
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":363 */
-    __pyx_v_on_data = ((long (*))__pyx_v_on->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":364 */
-    __pyx_v_om_data = ((long (*))__pyx_v_om->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":365 */
-    __pyx_v_oN_data = ((long (*))__pyx_v_oN->data);
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":367 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":385 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":368 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":386 */
+    __pyx_2 = PyArray_MultiIterNew(3,((void (*))__pyx_v_on),((void (*))__pyx_v_om),((void (*))__pyx_v_oN)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":369 */
-      __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":387 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":371 */
-      __pyx_2 = PyArray_MultiIterNew(3,((void (*))__pyx_v_on),((void (*))__pyx_v_om),((void (*))__pyx_v_oN)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":388 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":372 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_multi->nd,__pyx_v_multi->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":389 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":373 */
-      __pyx_v_array_data = ((long (*))arrayObject->data);
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":390 */
+      __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":374 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":391 */
+      __pyx_v_om_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":375 */
-        __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,0));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":392 */
+      __pyx_v_oN_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":376 */
-        __pyx_v_om_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":393 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":377 */
-        __pyx_v_oN_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":378 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":379 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":394 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":381 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
-    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":396 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
-    __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; goto __pyx_L1;}
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
@@ -1338,77 +1472,58 @@
     arrayObject = ((PyArrayObject *)__pyx_2);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":382 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":397 */
     __pyx_v_array_data = ((long (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":383 */
-    __pyx_1 = __pyx_v_scalar;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":398 */
+    __pyx_4 = PyArray_MultiIterNew(4,((void (*))arrayObject),((void (*))__pyx_v_on),((void (*))__pyx_v_om),((void (*))__pyx_v_oN)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":400 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
     if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":384 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
-
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":385 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":386 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":401 */
+      __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; goto __pyx_L1;}
+      Py_INCREF(__pyx_k65p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k65p);
+      __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; goto __pyx_L1;}
+      Py_DECREF(__pyx_5); __pyx_5 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 401; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":388 */
-      __pyx_4 = PyArray_MultiIterNew(4,((void (*))arrayObject),((void (*))__pyx_v_on),((void (*))__pyx_v_om),((void (*))__pyx_v_oN)); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_4)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_4);
-      Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":402 */
+    __pyx_3 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":390 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":403 */
+      __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":391 */
-        __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
-        __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
-        Py_INCREF(__pyx_k65p);
-        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k65p);
-        __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
-        Py_DECREF(__pyx_5); __pyx_5 = 0;
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __Pyx_Raise(__pyx_4, 0, 0);
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":404 */
+      __pyx_v_om_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":392 */
-      __pyx_3 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_3; ++__pyx_v_i) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":405 */
+      __pyx_v_oN_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,3));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":393 */
-        __pyx_v_on_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":406 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":394 */
-        __pyx_v_om_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,2));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":395 */
-        __pyx_v_oN_data = ((long (*))PyArray_MultiIter_DATA(__pyx_v_multi,3));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":396 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_on_data[0]),(__pyx_v_om_data[0]),(__pyx_v_oN_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":397 */
-        PyArray_MultiIter_NEXT(__pyx_v_multi);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":407 */
+      PyArray_MultiIter_NEXT(__pyx_v_multi);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":399 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":409 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -1431,6 +1546,86 @@
   return __pyx_r;
 }
 
+static PyObject *__pyx_f_6mtrand_discd_array_sc(rk_state (*__pyx_v_state),long ((*__pyx_v_func)(rk_state (*),double )),PyObject *__pyx_v_size,double __pyx_v_a) {
+  long (*__pyx_v_array_data);
+  PyArrayObject *arrayObject;
+  long __pyx_v_length;
+  long __pyx_v_i;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_size);
+  arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":417 */
+  __pyx_1 = __pyx_v_size == Py_None;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":418 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,__pyx_v_a)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  /*else*/ {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":420 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_Int); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    Py_INCREF(__pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
+    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_4);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":421 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":422 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":423 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":424 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,__pyx_v_a);
+    }
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":425 */
+    Py_INCREF(((PyObject *)arrayObject));
+    __pyx_r = ((PyObject *)arrayObject);
+    goto __pyx_L0;
+  }
+  __pyx_L2:;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("mtrand.discd_array_sc");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(arrayObject);
+  Py_DECREF(__pyx_v_size);
+  return __pyx_r;
+}
+
 static PyObject *__pyx_k66p;
 
 static char (__pyx_k66[]) = "size is not compatible with inputs";
@@ -1443,7 +1638,6 @@
   npy_intp __pyx_v_i;
   PyArrayMultiIterObject *__pyx_v_multi;
   PyArrayIterObject *__pyx_v_itera;
-  int __pyx_v_scalar;
   PyObject *__pyx_r;
   int __pyx_1;
   PyObject *__pyx_2 = 0;
@@ -1456,85 +1650,54 @@
   __pyx_v_multi = ((PyArrayMultiIterObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_itera = ((PyArrayIterObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":411 */
-  __pyx_v_scalar = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":412 */
-  __pyx_1 = (__pyx_v_oa->nd == 0);
-  if (__pyx_1) {
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":413 */
-    __pyx_v_oa_data = ((double (*))__pyx_v_oa->data);
-
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":414 */
-    __pyx_v_scalar = 1;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":416 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":436 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":417 */
-    __pyx_1 = __pyx_v_scalar;
-    if (__pyx_1) {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":437 */
+    __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)arrayObject));
+    arrayObject = ((PyArrayObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":418 */
-      __pyx_2 = PyInt_FromLong(__pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]))); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; goto __pyx_L1;}
-      __pyx_r = __pyx_2;
-      __pyx_2 = 0;
-      goto __pyx_L0;
-      goto __pyx_L4;
-    }
-    /*else*/ {
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":438 */
+    __pyx_v_length = PyArray_SIZE(arrayObject);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":420 */
-      __pyx_2 = PyArray_SimpleNew(__pyx_v_oa->nd,__pyx_v_oa->dimensions,NPY_LONG); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)arrayObject));
-      arrayObject = ((PyArrayObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":439 */
+    __pyx_v_array_data = ((long (*))arrayObject->data);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":421 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":440 */
+    __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
+    Py_DECREF(((PyObject *)__pyx_v_itera));
+    __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":422 */
-      __pyx_v_array_data = ((long (*))arrayObject->data);
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":441 */
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":423 */
-      __pyx_2 = PyArray_IterNew(((PyObject *)__pyx_v_oa)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 423; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayIterObject *)__pyx_2)));
-      Py_DECREF(((PyObject *)__pyx_v_itera));
-      __pyx_v_itera = ((PyArrayIterObject *)__pyx_2);
-      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":442 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double (*))__pyx_v_itera->dataptr)[0]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":424 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":425 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(((double (*))__pyx_v_itera->dataptr)[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":426 */
-        PyArray_ITER_NEXT(__pyx_v_itera);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":443 */
+      PyArray_ITER_NEXT(__pyx_v_itera);
     }
-    __pyx_L4:;
-    goto __pyx_L3;
+    goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":428 */
-    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}
-    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":445 */
+    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_empty); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; goto __pyx_L1;}
+    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
@@ -1542,71 +1705,52 @@
     arrayObject = ((PyArrayObject *)__pyx_2);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":429 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":446 */
     __pyx_v_array_data = ((long (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":430 */
-    __pyx_1 = __pyx_v_scalar;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":447 */
+    __pyx_3 = PyArray_MultiIterNew(2,((void (*))arrayObject),((void (*))__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
+    Py_DECREF(((PyObject *)__pyx_v_multi));
+    __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":448 */
+    __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
     if (__pyx_1) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":431 */
-      __pyx_v_length = PyArray_SIZE(arrayObject);
-
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":432 */
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":433 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
-      }
-      goto __pyx_L7;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":449 */
+      __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
+      Py_INCREF(__pyx_k66p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k66p);
+      __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; goto __pyx_L1;}
+      goto __pyx_L5;
     }
-    /*else*/ {
+    __pyx_L5:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":435 */
-      __pyx_3 = PyArray_MultiIterNew(2,((void (*))arrayObject),((void (*))__pyx_v_oa)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; goto __pyx_L1;}
-      Py_INCREF(((PyObject *)((PyArrayMultiIterObject *)__pyx_3)));
-      Py_DECREF(((PyObject *)__pyx_v_multi));
-      __pyx_v_multi = ((PyArrayMultiIterObject *)__pyx_3);
-      Py_DECREF(__pyx_3); __pyx_3 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":450 */
+    __pyx_5 = __pyx_v_multi->size;
+    for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":436 */
-      __pyx_1 = (__pyx_v_multi->size != PyArray_SIZE(arrayObject));
-      if (__pyx_1) {
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":451 */
+      __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":437 */
-        __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
-        __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
-        Py_INCREF(__pyx_k66p);
-        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k66p);
-        __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
-        Py_DECREF(__pyx_4); __pyx_4 = 0;
-        Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __Pyx_Raise(__pyx_3, 0, 0);
-        Py_DECREF(__pyx_3); __pyx_3 = 0;
-        {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; goto __pyx_L1;}
-        goto __pyx_L10;
-      }
-      __pyx_L10:;
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":452 */
+      (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":438 */
-      __pyx_5 = __pyx_v_multi->size;
-      for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":439 */
-        __pyx_v_oa_data = ((double (*))PyArray_MultiIter_DATA(__pyx_v_multi,1));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":440 */
-        (__pyx_v_array_data[__pyx_v_i]) = __pyx_v_func(__pyx_v_state,(__pyx_v_oa_data[0]));
-
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":441 */
-        PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
-      }
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":453 */
+      PyArray_MultiIter_NEXTi(__pyx_v_multi,1);
     }
-    __pyx_L7:;
   }
-  __pyx_L3:;
+  __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":442 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":454 */
   Py_INCREF(((PyObject *)arrayObject));
   __pyx_r = ((PyObject *)arrayObject);
   goto __pyx_L0;
@@ -1636,29 +1780,29 @@
   long __pyx_v_i;
   double __pyx_r;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":447 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":459 */
   __pyx_v_sum = (__pyx_v_darr[0]);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":448 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":460 */
   __pyx_v_c = 0.0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":449 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":461 */
   for (__pyx_v_i = 1; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":450 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":462 */
     __pyx_v_y = ((__pyx_v_darr[__pyx_v_i]) - __pyx_v_c);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":451 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":463 */
     __pyx_v_t = (__pyx_v_sum + __pyx_v_y);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":452 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":464 */
     __pyx_v_c = ((__pyx_v_t - __pyx_v_sum) - __pyx_v_y);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":453 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":465 */
     __pyx_v_sum = __pyx_v_t;
   }
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":454 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":466 */
   __pyx_r = __pyx_v_sum;
   goto __pyx_L0;
 
@@ -1680,15 +1824,15 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_seed);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":477 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":489 */
   ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = ((rk_state (*))PyMem_Malloc((sizeof(rk_state ))));
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":479 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":491 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_seed); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; goto __pyx_L1;}
   Py_INCREF(__pyx_v_seed);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_seed);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
@@ -1712,14 +1856,14 @@
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":482 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":494 */
   __pyx_1 = (((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state != NULL);
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":483 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":495 */
     PyMem_Free(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":484 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":496 */
     ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state = NULL;
     goto __pyx_L2;
   }
@@ -1749,42 +1893,42 @@
   Py_INCREF(__pyx_v_seed);
   arrayObject_obj = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":498 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":510 */
   __pyx_1 = __pyx_v_seed == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":499 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":511 */
     __pyx_v_errcode = rk_randomseed(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
     goto __pyx_L2;
   }
-  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
   Py_INCREF(__pyx_v_seed);
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_seed);
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; goto __pyx_L1;}
   __pyx_1 = __pyx_4 == __pyx_2;
   Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":501 */
-    __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":513 */
+    __pyx_5 = PyInt_AsUnsignedLongMask(__pyx_v_seed); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
     rk_seed(__pyx_5,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
     goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":503 */
-    __pyx_3 = PyArray_ContiguousFromObject(__pyx_v_seed,NPY_LONG,1,1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":515 */
+    __pyx_3 = PyArray_ContiguousFromObject(__pyx_v_seed,NPY_LONG,1,1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
     Py_DECREF(((PyObject *)arrayObject_obj));
     arrayObject_obj = ((PyArrayObject *)__pyx_3);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":504 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":516 */
     init_by_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,((unsigned long (*))arrayObject_obj->data),(arrayObject_obj->dimensions[0]));
   }
   __pyx_L2:;
@@ -1821,18 +1965,18 @@
   Py_INCREF(__pyx_v_self);
   arrayObject_state = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":513 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":525 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(624); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
+  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
   PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
   __pyx_1 = 0;
   __pyx_3 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
@@ -1840,12 +1984,12 @@
   arrayObject_state = ((PyArrayObject *)__pyx_1);
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":514 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":526 */
   memcpy(((void (*))arrayObject_state->data),((void (*))((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key),(624 * (sizeof(long ))));
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":515 */
-  __pyx_3 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":527 */
+  __pyx_3 = PyInt_FromLong(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}
   Py_INCREF(__pyx_n_MT19937);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_MT19937);
   Py_INCREF(((PyObject *)arrayObject_state));
@@ -1898,79 +2042,79 @@
   __pyx_v_algorithm_name = Py_None; Py_INCREF(Py_None);
   __pyx_v_key = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":526 */
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":538 */
+  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetItem(__pyx_v_state, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_algorithm_name);
   __pyx_v_algorithm_name = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":527 */
-  if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":539 */
+  if (PyObject_Cmp(__pyx_v_algorithm_name, __pyx_n_MT19937, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; goto __pyx_L1;}
   __pyx_3 = __pyx_3 != 0;
   if (__pyx_3) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":528 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":540 */
+    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}
     Py_INCREF(__pyx_k69p);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k69p);
-    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_4, 0, 0);
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":529 */
-  __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":541 */
+  __pyx_1 = PySequence_GetSlice(__pyx_v_state, 1, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_4 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
+  __pyx_4 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
   Py_DECREF(__pyx_v_key);
   __pyx_v_key = __pyx_4;
   __pyx_4 = 0;
-  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
-  __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
+  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
+  __pyx_3 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   __pyx_v_pos = __pyx_3;
-  if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; goto __pyx_L1;}
+  if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":530 */
-  __pyx_4 = PyArray_ContiguousFromObject(__pyx_v_key,NPY_LONG,1,1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":542 */
+  __pyx_4 = PyArray_ContiguousFromObject(__pyx_v_key,NPY_LONG,1,1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; goto __pyx_L1;}
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)arrayObject_obj));
   arrayObject_obj = ((PyArrayObject *)__pyx_4);
   Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":531 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":543 */
   __pyx_3 = ((arrayObject_obj->dimensions[0]) != 624);
   if (__pyx_3) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":532 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":544 */
+    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
     Py_INCREF(__pyx_k70p);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k70p);
-    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_4, 0, 0);
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":533 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":545 */
   memcpy(((void (*))((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->key),((void (*))arrayObject_obj->data),(624 * (sizeof(long ))));
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":534 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":546 */
   ((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state->pos = __pyx_v_pos;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
@@ -1999,9 +2143,9 @@
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":538 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":550 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
@@ -2031,12 +2175,12 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_state);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":541 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":553 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_set_state); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;}
   Py_INCREF(__pyx_v_state);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_state);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
@@ -2069,17 +2213,17 @@
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":544 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":556 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_random); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n___RandomState_ctor); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
-  __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_get_state); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
   PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
   PyTuple_SET_ITEM(__pyx_3, 2, __pyx_4);
@@ -2116,8 +2260,8 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":552 */
-  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":564 */
+  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_double,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
@@ -2146,8 +2290,8 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":559 */
-  __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":571 */
+  __pyx_1 = __pyx_f_6mtrand_disc0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_long,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
@@ -2197,58 +2341,58 @@
   Py_INCREF(__pyx_v_size);
   arrayObject = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":574 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":586 */
   __pyx_1 = __pyx_v_high == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":575 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":587 */
     __pyx_v_lo = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":576 */
-    __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":588 */
+    __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
     __pyx_v_hi = __pyx_2;
     goto __pyx_L2;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":578 */
-    __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":590 */
+    __pyx_2 = PyInt_AsLong(__pyx_v_low); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; goto __pyx_L1;}
     __pyx_v_lo = __pyx_2;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":579 */
-    __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":591 */
+    __pyx_2 = PyInt_AsLong(__pyx_v_high); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 591; goto __pyx_L1;}
     __pyx_v_hi = __pyx_2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":581 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":593 */
   __pyx_v_diff = ((__pyx_v_hi - __pyx_v_lo) - 1);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":582 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":594 */
   __pyx_1 = (__pyx_v_diff < 0);
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":583 */
-    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":595 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
     Py_INCREF(__pyx_k71p);
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k71p);
-    __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; goto __pyx_L1;}
+    __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_5, 0, 0);
     Py_DECREF(__pyx_5); __pyx_5 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 583; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":585 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":597 */
   __pyx_1 = __pyx_v_size == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":586 */
-    __pyx_3 = PyLong_FromUnsignedLong((rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state) + __pyx_v_lo)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":598 */
+    __pyx_3 = PyLong_FromUnsignedLong((rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state) + __pyx_v_lo)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 598; goto __pyx_L1;}
     __pyx_r = __pyx_3;
     __pyx_3 = 0;
     goto __pyx_L0;
@@ -2256,17 +2400,17 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":588 */
-    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
-    __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":600 */
+    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;}
+    __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_empty); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     __pyx_3 = 0;
-    __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 588; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; goto __pyx_L1;}
     Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
@@ -2274,20 +2418,20 @@
     arrayObject = ((PyArrayObject *)__pyx_3);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":589 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":601 */
     __pyx_v_length = PyArray_SIZE(arrayObject);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":590 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":602 */
     __pyx_v_array_data = ((long (*))arrayObject->data);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":591 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":603 */
     for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_length; ++__pyx_v_i) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":592 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":604 */
       (__pyx_v_array_data[__pyx_v_i]) = (__pyx_v_lo + ((long )rk_interval(__pyx_v_diff,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state)));
     }
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":593 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":605 */
     Py_INCREF(((PyObject *)arrayObject));
     __pyx_r = ((PyObject *)arrayObject);
     goto __pyx_L0;
@@ -2324,22 +2468,19 @@
   Py_INCREF(__pyx_v_self);
   __pyx_v_bytestring = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":601 */
-  __pyx_v_bytes = PyMem_Malloc(__pyx_v_length);
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":602 */
-  rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":603 */
-  __pyx_1 = PyString_FromStringAndSize(((char (*))__pyx_v_bytes),__pyx_v_length); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 603; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":613 */
+  __pyx_1 = PyString_FromStringAndSize(NULL,__pyx_v_length); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; goto __pyx_L1;}
   Py_DECREF(__pyx_v_bytestring);
   __pyx_v_bytestring = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":604 */
-  PyMem_Free(__pyx_v_bytes);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":614 */
+  __pyx_v_bytes = PyString_AS_STRING(__pyx_v_bytestring);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":605 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":615 */
+  rk_fill(__pyx_v_bytes,__pyx_v_length,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":616 */
   Py_INCREF(__pyx_v_bytestring);
   __pyx_r = __pyx_v_bytestring;
   goto __pyx_L0;
@@ -2367,11 +2508,14 @@
   PyArrayObject *__pyx_v_olow;
   PyArrayObject *__pyx_v_ohigh;
   PyArrayObject *__pyx_v_odiff;
+  double __pyx_v_flow;
+  double __pyx_v_fhigh;
   PyObject *__pyx_v_temp;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
   static char *__pyx_argnames[] = {"low","high","size",0};
   __pyx_v_low = __pyx_k8;
   __pyx_v_high = __pyx_k9;
@@ -2386,58 +2530,80 @@
   __pyx_v_odiff = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_temp = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":616 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_low,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":627 */
+  __pyx_v_flow = PyFloat_AsDouble(__pyx_v_low);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":628 */
+  __pyx_v_fhigh = PyFloat_AsDouble(__pyx_v_high);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":629 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":630 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_flow,(__pyx_v_fhigh - __pyx_v_flow)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":631 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":632 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_low,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
   Py_DECREF(((PyObject *)__pyx_v_olow));
-  __pyx_v_olow = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_olow = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":617 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_high,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":633 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_high,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
   Py_DECREF(((PyObject *)__pyx_v_ohigh));
-  __pyx_v_ohigh = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_ohigh = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":618 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_subtract); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":634 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_subtract); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_ohigh));
-  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_ohigh));
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ohigh));
   Py_INCREF(((PyObject *)__pyx_v_olow));
-  PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_v_olow));
-  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_olow));
+  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_temp);
-  __pyx_v_temp = __pyx_3;
-  __pyx_3 = 0;
+  __pyx_v_temp = __pyx_4;
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":619 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":635 */
   Py_INCREF(__pyx_v_temp);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":621 */
-  __pyx_2 = PyArray_EnsureArray(__pyx_v_temp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":637 */
+  __pyx_3 = PyArray_EnsureArray(__pyx_v_temp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_odiff));
-  __pyx_v_odiff = ((PyArrayObject *)__pyx_2);
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_v_odiff = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":622 */
-  __pyx_1 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_olow,__pyx_v_odiff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":638 */
+  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_uniform,__pyx_v_size,__pyx_v_olow,__pyx_v_odiff); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
+  __pyx_r = __pyx_2;
+  __pyx_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
   __Pyx_AddTraceback("mtrand.RandomState.uniform");
   __pyx_r = 0;
   __pyx_L0:;
@@ -2476,24 +2642,24 @@
   }
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":635 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":651 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
   Py_INCREF(__pyx_v_args);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
   __pyx_4 = __pyx_4 == 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":636 */
-    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;}
-    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":652 */
+    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 652; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __pyx_r = __pyx_3;
     __pyx_3 = 0;
@@ -2502,12 +2668,12 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":638 */
-    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
-    __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
-    if (PyDict_SetItem(__pyx_3, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
-    __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 638; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":654 */
+    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_random_sample); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}
+    __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}
+    if (PyDict_SetItem(__pyx_3, __pyx_n_size, __pyx_v_args) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}
+    __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
@@ -2553,24 +2719,24 @@
   }
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":650 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":666 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
   Py_INCREF(__pyx_v_args);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 666; goto __pyx_L1;}
   __pyx_4 = __pyx_4 == 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":651 */
-    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
-    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 651; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":667 */
+    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __pyx_r = __pyx_3;
     __pyx_3 = 0;
@@ -2579,12 +2745,12 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":653 */
-    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":669 */
+    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;}
     Py_INCREF(__pyx_v_args);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_args);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; goto __pyx_L1;}
+    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __pyx_r = __pyx_3;
@@ -2629,17 +2795,17 @@
   Py_INCREF(__pyx_v_high);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":662 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":678 */
   __pyx_1 = __pyx_v_high == Py_None;
   if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":663 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":679 */
     Py_INCREF(__pyx_v_low);
     Py_DECREF(__pyx_v_high);
     __pyx_v_high = __pyx_v_low;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":664 */
-    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":680 */
+    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; goto __pyx_L1;}
     Py_DECREF(__pyx_v_low);
     __pyx_v_low = __pyx_2;
     __pyx_2 = 0;
@@ -2647,19 +2813,19 @@
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":665 */
-  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}
-  __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}
-  __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":681 */
+  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_randint); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
+  __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
+  __pyx_4 = PyNumber_Add(__pyx_v_high, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
   Py_INCREF(__pyx_v_low);
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_low);
   PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
   Py_INCREF(__pyx_v_size);
   PyTuple_SET_ITEM(__pyx_3, 2, __pyx_v_size);
   __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 681; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   __pyx_r = __pyx_4;
@@ -2694,8 +2860,8 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":673 */
-  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":689 */
+  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gauss,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 689; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
@@ -2716,8 +2882,10 @@
 static PyObject *__pyx_n_less_equal;
 
 static PyObject *__pyx_k73p;
+static PyObject *__pyx_k74p;
 
 static char (__pyx_k73[]) = "scale <= 0";
+static char (__pyx_k74[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_normal[] = "Normal distribution (mean=loc, stdev=scale).\n\n        normal(loc=0.0, scale=1.0, size=None) -> random values\n        ";
@@ -2727,12 +2895,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oloc;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_floc;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"loc","scale","size",0};
   __pyx_v_loc = __pyx_k14;
   __pyx_v_scale = __pyx_k15;
@@ -2745,74 +2915,115 @@
   __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":682 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":699 */
+  __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":700 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":701 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":702 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":703 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}
+      Py_INCREF(__pyx_k73p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k73p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":704 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":706 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":708 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oloc));
-  __pyx_v_oloc = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":683 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":709 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":684 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":710 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":685 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}
-    Py_INCREF(__pyx_k73p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k73p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":711 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+    Py_INCREF(__pyx_k74p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k74p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":686 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 686; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":712 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_normal,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.normal");
   __pyx_r = 0;
   __pyx_L0:;
@@ -2825,11 +3036,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k74p;
 static PyObject *__pyx_k75p;
+static PyObject *__pyx_k76p;
+static PyObject *__pyx_k77p;
+static PyObject *__pyx_k78p;
 
-static char (__pyx_k74[]) = "a <= 0";
-static char (__pyx_k75[]) = "b <= 0";
+static char (__pyx_k75[]) = "a <= 0";
+static char (__pyx_k76[]) = "b <= 0";
+static char (__pyx_k77[]) = "a <= 0";
+static char (__pyx_k78[]) = "b <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_beta(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_beta[] = "Beta distribution over [0, 1].\n\n        beta(a, b, size=None) -> random values\n        ";
@@ -2839,12 +3054,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oa;
   PyArrayObject *__pyx_v_ob;
+  double __pyx_v_fa;
+  double __pyx_v_fb;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"a","b","size",0};
   __pyx_v_size = __pyx_k17;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_b, &__pyx_v_size)) return 0;
@@ -2855,115 +3072,175 @@
   __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_ob = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":695 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 695; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_oa));
-  __pyx_v_oa = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":722 */
+  __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":696 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_b,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_ob));
-  __pyx_v_ob = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":723 */
+  __pyx_v_fb = PyFloat_AsDouble(__pyx_v_b);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":698 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":724 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":699 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
-    Py_INCREF(__pyx_k74p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k74p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 699; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":725 */
+    __pyx_1 = (__pyx_v_fa <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":726 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}
+      Py_INCREF(__pyx_k75p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k75p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 726; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":727 */
+    __pyx_1 = (__pyx_v_fb <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":728 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}
+      Py_INCREF(__pyx_k76p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k76p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":729 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_fa,__pyx_v_fb); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":700 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":731 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":733 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+  Py_DECREF(((PyObject *)__pyx_v_oa));
+  __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":734 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_b,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+  Py_DECREF(((PyObject *)__pyx_v_ob));
+  __pyx_v_ob = ((PyArrayObject *)__pyx_4);
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":735 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_ob));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ob));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
   __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
   __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":701 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
-    Py_INCREF(__pyx_k75p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k75p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":736 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}
+    Py_INCREF(__pyx_k77p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k77p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; goto __pyx_L1;}
-    goto __pyx_L3;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":702 */
-  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_oa,__pyx_v_ob); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; goto __pyx_L1;}
-  __pyx_r = __pyx_2;
-  __pyx_2 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":737 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_ob));
+  PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_ob));
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":738 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; goto __pyx_L1;}
+    Py_INCREF(__pyx_k78p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k78p);
+    __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; goto __pyx_L1;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":739 */
+  __pyx_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_beta,__pyx_v_size,__pyx_v_oa,__pyx_v_ob); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.beta");
   __pyx_r = 0;
   __pyx_L0:;
@@ -2976,9 +3253,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k76p;
+static PyObject *__pyx_k79p;
+static PyObject *__pyx_k80p;
 
-static char (__pyx_k76[]) = "scale <= 0";
+static char (__pyx_k79[]) = "scale <= 0";
+static char (__pyx_k80[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_exponential(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_exponential[] = "Exponential distribution.\n\n        exponential(scale=1.0, size=None) -> random values\n        ";
@@ -2986,12 +3265,13 @@
   PyObject *__pyx_v_scale = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"scale","size",0};
   __pyx_v_scale = __pyx_k18;
   __pyx_v_size = __pyx_k19;
@@ -3001,67 +3281,105 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":710 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 710; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":749 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":750 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":751 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":752 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;}
+      Py_INCREF(__pyx_k79p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k79p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":753 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":755 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":757 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":711 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":758 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":712 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
-    Py_INCREF(__pyx_k76p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k76p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":759 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+    Py_INCREF(__pyx_k80p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k80p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":713 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":760 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_exponential,__pyx_v_size,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.exponential");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3084,8 +3402,8 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":720 */
-  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":767 */
+  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_exponential,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 767; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
@@ -3102,22 +3420,27 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k77p;
+static PyObject *__pyx_n_fscale;
 
-static char (__pyx_k77[]) = "shape <= 0";
+static PyObject *__pyx_k81p;
+static PyObject *__pyx_k82p;
 
+static char (__pyx_k81[]) = "shape <= 0";
+static char (__pyx_k82[]) = "shape <= 0";
+
 static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_standard_gamma[] = "Standard Gamma distribution.\n\n        standard_gamma(shape, size=None) -> random values\n        ";
 static PyObject *__pyx_f_6mtrand_11RandomState_standard_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_shape = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oshape;
+  double __pyx_v_fshape;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"shape","size",0};
   __pyx_v_size = __pyx_k21;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_shape, &__pyx_v_size)) return 0;
@@ -3126,67 +3449,110 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":728 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":777 */
+  __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":778 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":779 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+    __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+    __pyx_1 = __pyx_1 <= 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":780 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
+      Py_INCREF(__pyx_k81p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k81p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":781 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_fshape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":783 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":784 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 784; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oshape));
-  __pyx_v_oshape = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oshape = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":729 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":785 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oshape));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oshape));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oshape));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 785; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":730 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; goto __pyx_L1;}
-    Py_INCREF(__pyx_k77p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k77p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":786 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; goto __pyx_L1;}
+    Py_INCREF(__pyx_k82p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k82p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":731 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_oshape); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":787 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_gamma,__pyx_v_size,__pyx_v_oshape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 787; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.standard_gamma");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3197,11 +3563,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k78p;
-static PyObject *__pyx_k79p;
+static PyObject *__pyx_k83p;
+static PyObject *__pyx_k84p;
+static PyObject *__pyx_k85p;
+static PyObject *__pyx_k86p;
 
-static char (__pyx_k78[]) = "shape <= 0";
-static char (__pyx_k79[]) = "scale <= 0";
+static char (__pyx_k83[]) = "shape <= 0";
+static char (__pyx_k84[]) = "scale <= 0";
+static char (__pyx_k85[]) = "shape <= 0";
+static char (__pyx_k86[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_gamma(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_gamma[] = "Gamma distribution.\n\n        gamma(shape, scale=1.0, size=None) -> random values\n        ";
@@ -3211,12 +3581,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oshape;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_fshape;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"shape","scale","size",0};
   __pyx_v_scale = __pyx_k22;
   __pyx_v_size = __pyx_k23;
@@ -3228,115 +3600,175 @@
   __pyx_v_oshape = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":740 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_oshape));
-  __pyx_v_oshape = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":797 */
+  __pyx_v_fshape = PyFloat_AsDouble(__pyx_v_shape);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":741 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":798 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":742 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_oshape));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oshape));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 742; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":799 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":743 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; goto __pyx_L1;}
-    Py_INCREF(__pyx_k78p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k78p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":800 */
+    __pyx_1 = (__pyx_v_fshape <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":801 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}
+      Py_INCREF(__pyx_k83p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k83p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":802 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":803 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}
+      Py_INCREF(__pyx_k84p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k84p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":804 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_fshape,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":744 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":806 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":807 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_shape,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+  Py_DECREF(((PyObject *)__pyx_v_oshape));
+  __pyx_v_oshape = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":808 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+  Py_DECREF(((PyObject *)__pyx_v_oscale));
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":809 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_oshape));
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oshape));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
   __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
   __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 809; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":745 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}
-    Py_INCREF(__pyx_k79p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k79p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":810 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
+    Py_INCREF(__pyx_k85p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k85p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; goto __pyx_L1;}
-    goto __pyx_L3;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 810; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":746 */
-  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_oshape,__pyx_v_oscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; goto __pyx_L1;}
-  __pyx_r = __pyx_2;
-  __pyx_2 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":811 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":812 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
+    Py_INCREF(__pyx_k86p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k86p);
+    __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; goto __pyx_L1;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":813 */
+  __pyx_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gamma,__pyx_v_size,__pyx_v_oshape,__pyx_v_oscale); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 813; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.gamma");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3349,11 +3781,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k80p;
-static PyObject *__pyx_k81p;
+static PyObject *__pyx_k87p;
+static PyObject *__pyx_k88p;
+static PyObject *__pyx_k89p;
+static PyObject *__pyx_k90p;
 
-static char (__pyx_k80[]) = "dfnum <= 0";
-static char (__pyx_k81[]) = "dfden <= 0";
+static char (__pyx_k87[]) = "shape <= 0";
+static char (__pyx_k88[]) = "scale <= 0";
+static char (__pyx_k89[]) = "dfnum <= 0";
+static char (__pyx_k90[]) = "dfden <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_f[] = "F distribution.\n\n        f(dfnum, dfden, size=None) -> random values\n        ";
@@ -3363,12 +3799,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_odfnum;
   PyArrayObject *__pyx_v_odfden;
+  double __pyx_v_fdfnum;
+  double __pyx_v_fdfden;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"dfnum","dfden","size",0};
   __pyx_v_size = __pyx_k24;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_size)) return 0;
@@ -3379,115 +3817,175 @@
   __pyx_v_odfnum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":755 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_odfnum));
-  __pyx_v_odfnum = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":823 */
+  __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":756 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 756; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_odfden));
-  __pyx_v_odfden = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":824 */
+  __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":757 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_odfnum));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odfnum));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":825 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":758 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
-    Py_INCREF(__pyx_k80p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k80p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":826 */
+    __pyx_1 = (__pyx_v_fdfnum <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":827 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
+      Py_INCREF(__pyx_k87p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k87p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":828 */
+    __pyx_1 = (__pyx_v_fdfden <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":829 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+      Py_INCREF(__pyx_k88p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k88p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 829; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":830 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_fdfnum,__pyx_v_fdfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 830; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":759 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":832 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":834 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+  Py_DECREF(((PyObject *)__pyx_v_odfnum));
+  __pyx_v_odfnum = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":835 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+  Py_DECREF(((PyObject *)__pyx_v_odfden));
+  __pyx_v_odfden = ((PyArrayObject *)__pyx_4);
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":836 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_odfden));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_odfden));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_odfnum));
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odfnum));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
   __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
   __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":760 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
-    Py_INCREF(__pyx_k81p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k81p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":837 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
+    Py_INCREF(__pyx_k89p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k89p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 760; goto __pyx_L1;}
-    goto __pyx_L3;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":761 */
-  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; goto __pyx_L1;}
-  __pyx_r = __pyx_2;
-  __pyx_2 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":838 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_odfden));
+  PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_odfden));
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":839 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+    Py_INCREF(__pyx_k90p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k90p);
+    __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":840 */
+  __pyx_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.f");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3502,13 +4000,19 @@
 
 static PyObject *__pyx_n_less;
 
-static PyObject *__pyx_k82p;
-static PyObject *__pyx_k83p;
-static PyObject *__pyx_k84p;
+static PyObject *__pyx_k91p;
+static PyObject *__pyx_k92p;
+static PyObject *__pyx_k93p;
+static PyObject *__pyx_k94p;
+static PyObject *__pyx_k95p;
+static PyObject *__pyx_k96p;
 
-static char (__pyx_k82[]) = "dfnum <= 1";
-static char (__pyx_k83[]) = "dfden <= 0";
-static char (__pyx_k84[]) = "nonc < 0";
+static char (__pyx_k91[]) = "dfnum <= 1";
+static char (__pyx_k92[]) = "dfden <= 0";
+static char (__pyx_k93[]) = "nonc < 0";
+static char (__pyx_k94[]) = "dfnum <= 1";
+static char (__pyx_k95[]) = "dfden <= 0";
+static char (__pyx_k96[]) = "nonc < 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_f(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_noncentral_f[] = "Noncentral F distribution.\n\n        noncentral_f(dfnum, dfden, nonc, size=None) -> random values\n        ";
@@ -3520,12 +4024,15 @@
   PyArrayObject *__pyx_v_odfnum;
   PyArrayObject *__pyx_v_odfden;
   PyArrayObject *__pyx_v_ononc;
+  double __pyx_v_fdfnum;
+  double __pyx_v_fdfden;
+  double __pyx_v_fnonc;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"dfnum","dfden","nonc","size",0};
   __pyx_v_size = __pyx_k25;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|O", __pyx_argnames, &__pyx_v_dfnum, &__pyx_v_dfden, &__pyx_v_nonc, &__pyx_v_size)) return 0;
@@ -3538,163 +4045,245 @@
   __pyx_v_odfden = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":771 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":850 */
+  __pyx_v_fdfnum = PyFloat_AsDouble(__pyx_v_dfnum);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":851 */
+  __pyx_v_fdfden = PyFloat_AsDouble(__pyx_v_dfden);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":852 */
+  __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":853 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":854 */
+    __pyx_1 = (__pyx_v_fdfnum <= 1);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":855 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}
+      Py_INCREF(__pyx_k91p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":856 */
+    __pyx_1 = (__pyx_v_fdfden <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":857 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}
+      Py_INCREF(__pyx_k92p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k92p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 857; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":858 */
+    __pyx_1 = (__pyx_v_fnonc < 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":859 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}
+      Py_INCREF(__pyx_k93p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; goto __pyx_L1;}
+      goto __pyx_L5;
+    }
+    __pyx_L5:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":860 */
+    __pyx_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_fdfnum,__pyx_v_fdfden,__pyx_v_fnonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":863 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":865 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_dfnum,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_odfnum));
-  __pyx_v_odfnum = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_odfnum = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":772 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":866 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_dfden,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)__pyx_v_odfden));
-  __pyx_v_odfden = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_odfden = ((PyArrayObject *)__pyx_4);
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":773 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 773; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":867 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
   Py_DECREF(((PyObject *)__pyx_v_ononc));
-  __pyx_v_ononc = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_ononc = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":775 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(1.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":869 */
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_odfnum));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odfnum));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odfnum));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":776 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; goto __pyx_L1;}
-    Py_INCREF(__pyx_k82p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k82p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":870 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;}
+    Py_INCREF(__pyx_k94p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k94p);
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L2:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":777 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":871 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
+  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_odfden));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_odfden));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odfden));
+  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_4); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":778 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}
-    Py_INCREF(__pyx_k83p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k83p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":872 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+    Py_INCREF(__pyx_k95p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k95p);
+    __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+    goto __pyx_L7;
   }
-  __pyx_L3:;
+  __pyx_L7:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":779 */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":873 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_2 = PyFloat_FromDouble(0.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_ononc));
-  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_ononc));
-  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ononc));
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 779; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":780 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
-    Py_INCREF(__pyx_k84p);
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k84p);
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":874 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
+    Py_INCREF(__pyx_k96p);
+    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k96p);
+    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; goto __pyx_L1;}
-    goto __pyx_L4;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
+    goto __pyx_L8;
   }
-  __pyx_L4:;
+  __pyx_L8:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":781 */
-  __pyx_1 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden,__pyx_v_ononc); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":875 */
+  __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_f,__pyx_v_size,__pyx_v_odfnum,__pyx_v_odfden,__pyx_v_ononc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 875; goto __pyx_L1;}
+  __pyx_r = __pyx_2;
+  __pyx_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.noncentral_f");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3709,9 +4298,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k85p;
+static PyObject *__pyx_k97p;
+static PyObject *__pyx_k98p;
 
-static char (__pyx_k85[]) = "df <= 0";
+static char (__pyx_k97[]) = "df <= 0";
+static char (__pyx_k98[]) = "df <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_chisquare[] = "Chi^2 distribution.\n\n        chisquare(df, size=None) -> random values\n        ";
@@ -3719,12 +4310,13 @@
   PyObject *__pyx_v_df = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_odf;
+  double __pyx_v_fdf;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"df","size",0};
   __pyx_v_size = __pyx_k26;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;
@@ -3733,67 +4325,108 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":790 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":886 */
+  __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":887 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":888 */
+    __pyx_1 = (__pyx_v_fdf <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":889 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+      Py_INCREF(__pyx_k97p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":890 */
+    __pyx_2 = PyFloat_FromDouble(__pyx_v_fdf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; goto __pyx_L1;}
+    if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; goto __pyx_L1;}
+    __pyx_3 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,((PyArrayObject *)__pyx_2)); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __pyx_r = __pyx_3;
+    __pyx_3 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":892 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":894 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)__pyx_v_odf));
-  __pyx_v_odf = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_odf = ((PyArrayObject *)__pyx_4);
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":791 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":895 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":792 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; goto __pyx_L1;}
-    Py_INCREF(__pyx_k85p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k85p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":896 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
+    Py_INCREF(__pyx_k98p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k98p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":793 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_odf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 793; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":897 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_chisquare,__pyx_v_size,__pyx_v_odf); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.chisquare");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3804,11 +4437,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k86p;
-static PyObject *__pyx_k87p;
+static PyObject *__pyx_k99p;
+static PyObject *__pyx_k100p;
+static PyObject *__pyx_k101p;
+static PyObject *__pyx_k102p;
 
-static char (__pyx_k86[]) = "df <= 1";
-static char (__pyx_k87[]) = "nonc < 0";
+static char (__pyx_k99[]) = "df <= 0";
+static char (__pyx_k100[]) = "nonc <= 0";
+static char (__pyx_k101[]) = "df <= 1";
+static char (__pyx_k102[]) = "nonc < 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_noncentral_chisquare(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_noncentral_chisquare[] = "Noncentral Chi^2 distribution.\n\n        noncentral_chisquare(df, nonc, size=None) -> random values\n        ";
@@ -3818,12 +4455,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_odf;
   PyArrayObject *__pyx_v_ononc;
+  double __pyx_v_fdf;
+  double __pyx_v_fnonc;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"df","nonc","size",0};
   __pyx_v_size = __pyx_k27;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_nonc, &__pyx_v_size)) return 0;
@@ -3834,115 +4473,175 @@
   __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_ononc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":802 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_odf));
-  __pyx_v_odf = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":906 */
+  __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":803 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_ononc));
-  __pyx_v_ononc = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":907 */
+  __pyx_v_fnonc = PyFloat_AsDouble(__pyx_v_nonc);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":804 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":908 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":805 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}
-    Py_INCREF(__pyx_k86p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k86p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":909 */
+    __pyx_1 = (__pyx_v_fdf <= 1);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":910 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
+      Py_INCREF(__pyx_k99p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":911 */
+    __pyx_1 = (__pyx_v_fnonc <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":912 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
+      Py_INCREF(__pyx_k100p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":913 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_fdf,__pyx_v_fnonc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":806 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":916 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":918 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+  Py_DECREF(((PyObject *)__pyx_v_odf));
+  __pyx_v_odf = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":919 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_nonc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 919; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+  Py_DECREF(((PyObject *)__pyx_v_ononc));
+  __pyx_v_ononc = ((PyArrayObject *)__pyx_4);
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":920 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_ononc));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ononc));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_odf));
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
   __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
   __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 920; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":807 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;}
-    Py_INCREF(__pyx_k87p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k87p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":921 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
+    Py_INCREF(__pyx_k101p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; goto __pyx_L1;}
-    goto __pyx_L3;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 921; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L3:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":808 */
-  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_odf,__pyx_v_ononc); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 808; goto __pyx_L1;}
-  __pyx_r = __pyx_2;
-  __pyx_2 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":922 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_ononc));
+  PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_ononc));
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 922; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":923 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
+    Py_INCREF(__pyx_k102p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k102p);
+    __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; goto __pyx_L1;}
+    goto __pyx_L6;
+  }
+  __pyx_L6:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":924 */
+  __pyx_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_noncentral_chisquare,__pyx_v_size,__pyx_v_odf,__pyx_v_ononc); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.noncentral_chisquare");
   __pyx_r = 0;
   __pyx_L0:;
@@ -3967,8 +4666,8 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_size);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":816 */
-  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":932 */
+  __pyx_1 = __pyx_f_6mtrand_cont0_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_cauchy,__pyx_v_size); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
@@ -3985,9 +4684,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k88p;
+static PyObject *__pyx_k103p;
+static PyObject *__pyx_k104p;
 
-static char (__pyx_k88[]) = "df <= 0";
+static char (__pyx_k103[]) = "df <= 0";
+static char (__pyx_k104[]) = "df <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_standard_t(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_standard_t[] = "Standard Student\'s t distribution with df degrees of freedom.\n\n        standard_t(df, size=None)\n        ";
@@ -3995,12 +4696,13 @@
   PyObject *__pyx_v_df = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_odf;
+  double __pyx_v_fdf;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"df","size",0};
   __pyx_v_size = __pyx_k29;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_df, &__pyx_v_size)) return 0;
@@ -4009,67 +4711,105 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_odf = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":824 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":942 */
+  __pyx_v_fdf = PyFloat_AsDouble(__pyx_v_df);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":943 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":944 */
+    __pyx_1 = (__pyx_v_fdf <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":945 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}
+      Py_INCREF(__pyx_k103p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":946 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_fdf); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":948 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":950 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_df,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_odf));
-  __pyx_v_odf = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_odf = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":825 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":951 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_odf));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_odf));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":826 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
-    Py_INCREF(__pyx_k88p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k88p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":952 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
+    Py_INCREF(__pyx_k104p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k104p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":827 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_odf); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 827; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":953 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_standard_t,__pyx_v_size,__pyx_v_odf); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.standard_t");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4080,9 +4820,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k89p;
+static PyObject *__pyx_k105p;
+static PyObject *__pyx_k106p;
 
-static char (__pyx_k89[]) = "kappa < 0";
+static char (__pyx_k105[]) = "kappa < 0";
+static char (__pyx_k106[]) = "kappa < 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_vonmises(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_vonmises[] = "von Mises circular distribution with mode mu and dispersion parameter\n        kappa on [-pi, pi].\n\n        vonmises(mu, kappa, size=None)\n        ";
@@ -4092,12 +4834,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_omu;
   PyArrayObject *__pyx_v_okappa;
+  double __pyx_v_fmu;
+  double __pyx_v_fkappa;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"mu","kappa","size",0};
   __pyx_v_size = __pyx_k30;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mu, &__pyx_v_kappa, &__pyx_v_size)) return 0;
@@ -4108,74 +4852,115 @@
   __pyx_v_omu = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_okappa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":837 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_mu,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":964 */
+  __pyx_v_fmu = PyFloat_AsDouble(__pyx_v_mu);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":965 */
+  __pyx_v_fkappa = PyFloat_AsDouble(__pyx_v_kappa);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":966 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":967 */
+    __pyx_1 = (__pyx_v_fkappa < 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":968 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;}
+      Py_INCREF(__pyx_k105p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":969 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_fmu,__pyx_v_fkappa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":971 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":973 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_mu,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_omu));
-  __pyx_v_omu = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_omu = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":838 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_kappa,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":974 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_kappa,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)__pyx_v_okappa));
-  __pyx_v_okappa = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_okappa = ((PyArrayObject *)__pyx_4);
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":839 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":975 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_okappa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_okappa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_okappa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":840 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
-    Py_INCREF(__pyx_k89p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k89p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":976 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+    Py_INCREF(__pyx_k106p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k106p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 840; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":841 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_omu,__pyx_v_okappa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":977 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_vonmises,__pyx_v_size,__pyx_v_omu,__pyx_v_okappa); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.vonmises");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4188,9 +4973,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k90p;
+static PyObject *__pyx_k107p;
+static PyObject *__pyx_k108p;
 
-static char (__pyx_k90[]) = "a <= 0";
+static char (__pyx_k107[]) = "a <= 0";
+static char (__pyx_k108[]) = "a <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_pareto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_pareto[] = "Pareto distribution.\n\n        pareto(a, size=None)\n        ";
@@ -4198,12 +4985,13 @@
   PyObject *__pyx_v_a = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oa;
+  double __pyx_v_fa;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"a","size",0};
   __pyx_v_size = __pyx_k31;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
@@ -4212,67 +5000,105 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":849 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":987 */
+  __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":988 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":989 */
+    __pyx_1 = (__pyx_v_fa <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":990 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
+      Py_INCREF(__pyx_k107p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k107p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":991 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":993 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":995 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oa));
-  __pyx_v_oa = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":850 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":996 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":851 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; goto __pyx_L1;}
-    Py_INCREF(__pyx_k90p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k90p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":997 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; goto __pyx_L1;}
+    Py_INCREF(__pyx_k108p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":852 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":998 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_pareto,__pyx_v_size,__pyx_v_oa); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 998; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.pareto");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4283,199 +5109,283 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k91p;
+static PyObject *__pyx_k109p;
+static PyObject *__pyx_k110p;
 
-static char (__pyx_k91[]) = "a <= 0";
+static char (__pyx_k109[]) = "a <= 0";
+static char (__pyx_k110[]) = "a <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_weibull[] = "Weibull distribution.\n\n        weibull(a, size=None)\n        ";
 static PyObject *__pyx_f_6mtrand_11RandomState_weibull(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  double __pyx_v_a;
+  PyObject *__pyx_v_a = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oa;
+  double __pyx_v_fa;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"a","size",0};
   __pyx_v_size = __pyx_k32;
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
   Py_INCREF(__pyx_v_self);
+  Py_INCREF(__pyx_v_a);
   Py_INCREF(__pyx_v_size);
   __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":860 */
-  __pyx_1 = PyFloat_FromDouble(__pyx_v_a); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; goto __pyx_L1;}
-  __pyx_2 = PyArray_FROM_OTF(__pyx_1,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1008 */
+  __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1009 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1010 */
+    __pyx_1 = (__pyx_v_fa <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1011 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
+      Py_INCREF(__pyx_k109p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k109p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1012 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1014 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1016 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1016; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oa));
-  __pyx_v_oa = ((PyArrayObject *)__pyx_2);
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":861 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1017 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 861; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":862 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
-    Py_INCREF(__pyx_k91p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k91p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1018 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; goto __pyx_L1;}
+    Py_INCREF(__pyx_k110p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k110p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 862; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1018; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":863 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 863; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1019 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_weibull,__pyx_v_size,__pyx_v_oa); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1019; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.weibull");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_oa);
   Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_a);
   Py_DECREF(__pyx_v_size);
   return __pyx_r;
 }
 
-static PyObject *__pyx_k92p;
+static PyObject *__pyx_k111p;
+static PyObject *__pyx_k112p;
 
-static char (__pyx_k92[]) = "a <= 0";
+static char (__pyx_k111[]) = "a <= 0";
+static char (__pyx_k112[]) = "a <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_power[] = "Power distribution.\n\n        power(a, size=None)\n        ";
 static PyObject *__pyx_f_6mtrand_11RandomState_power(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  double __pyx_v_a;
+  PyObject *__pyx_v_a = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oa;
+  double __pyx_v_fa;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"a","size",0};
   __pyx_v_size = __pyx_k33;
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "d|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
   Py_INCREF(__pyx_v_self);
+  Py_INCREF(__pyx_v_a);
   Py_INCREF(__pyx_v_size);
   __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":871 */
-  __pyx_1 = PyFloat_FromDouble(__pyx_v_a); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
-  __pyx_2 = PyArray_FROM_OTF(__pyx_1,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1029 */
+  __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1030 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1031 */
+    __pyx_1 = (__pyx_v_fa <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1032 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; goto __pyx_L1;}
+      Py_INCREF(__pyx_k111p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k111p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1033 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1035 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1037 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oa));
-  __pyx_v_oa = ((PyArrayObject *)__pyx_2);
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":872 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1038 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 872; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":873 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
-    Py_INCREF(__pyx_k92p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k92p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1039 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; goto __pyx_L1;}
+    Py_INCREF(__pyx_k112p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k112p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1039; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":874 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 874; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1040 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_power,__pyx_v_size,__pyx_v_oa); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1040; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.power");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_oa);
   Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_a);
   Py_DECREF(__pyx_v_size);
   return __pyx_r;
 }
 
-static PyObject *__pyx_k93p;
+static PyObject *__pyx_k113p;
+static PyObject *__pyx_k114p;
 
-static char (__pyx_k93[]) = "scale <= 0";
+static char (__pyx_k113[]) = "scale <= 0";
+static char (__pyx_k114[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_laplace(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_laplace[] = "Laplace distribution.\n        \n        laplace(loc=0.0, scale=1.0, size=None)\n        ";
@@ -4485,12 +5395,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oloc;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_floc;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"loc","scale","size",0};
   __pyx_v_loc = __pyx_k34;
   __pyx_v_scale = __pyx_k35;
@@ -4503,74 +5415,115 @@
   __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":883 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 883; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1050 */
+  __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1051 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1052 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1053 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1054 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
+      Py_INCREF(__pyx_k113p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k113p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1055 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1057 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1058 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oloc));
-  __pyx_v_oloc = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+  __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":884 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1059 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":885 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1060 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":886 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;}
-    Py_INCREF(__pyx_k93p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k93p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1061 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; goto __pyx_L1;}
+    Py_INCREF(__pyx_k114p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k114p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":887 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 887; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1062 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_laplace,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.laplace");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4583,9 +5536,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k94p;
+static PyObject *__pyx_k115p;
+static PyObject *__pyx_k116p;
 
-static char (__pyx_k94[]) = "scale <= 0";
+static char (__pyx_k115[]) = "scale <= 0";
+static char (__pyx_k116[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_gumbel(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_gumbel[] = "Gumbel distribution.\n        \n        gumbel(loc=0.0, scale=1.0, size=None)\n        ";
@@ -4595,12 +5550,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oloc;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_floc;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"loc","scale","size",0};
   __pyx_v_loc = __pyx_k37;
   __pyx_v_scale = __pyx_k38;
@@ -4613,74 +5570,115 @@
   __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":896 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1072 */
+  __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1073 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1074 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1075 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1076 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+      Py_INCREF(__pyx_k115p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k115p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1077 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1079 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1080 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1080; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oloc));
-  __pyx_v_oloc = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+  __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":897 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1081 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":898 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1082 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":899 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; goto __pyx_L1;}
-    Py_INCREF(__pyx_k94p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k94p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1083 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
+    Py_INCREF(__pyx_k116p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k116p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":900 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1084 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_gumbel,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.gumbel");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4693,9 +5691,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k95p;
+static PyObject *__pyx_k117p;
+static PyObject *__pyx_k118p;
 
-static char (__pyx_k95[]) = "scale <= 0";
+static char (__pyx_k117[]) = "scale <= 0";
+static char (__pyx_k118[]) = "scale <= 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_logistic(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_logistic[] = "Logistic distribution.\n        \n        logistic(loc=0.0, scale=1.0, size=None)\n        ";
@@ -4705,12 +5705,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oloc;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_floc;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"loc","scale","size",0};
   __pyx_v_loc = __pyx_k40;
   __pyx_v_scale = __pyx_k41;
@@ -4723,74 +5725,115 @@
   __pyx_v_oloc = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":909 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1094 */
+  __pyx_v_floc = PyFloat_AsDouble(__pyx_v_loc);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1095 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1096 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1097 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1098 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
+      Py_INCREF(__pyx_k117p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k117p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1098; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1099 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_floc,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1099; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1101 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1102 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_loc,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oloc));
-  __pyx_v_oloc = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oloc = ((PyArrayObject *)__pyx_3);
+  __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":910 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1103 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1103; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":911 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1104 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1104; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":912 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
-    Py_INCREF(__pyx_k95p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k95p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1105 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; goto __pyx_L1;}
+    Py_INCREF(__pyx_k118p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k118p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":913 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1106 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logistic,__pyx_v_size,__pyx_v_oloc,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.logistic");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4803,9 +5846,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k96p;
+static PyObject *__pyx_k119p;
+static PyObject *__pyx_k120p;
 
-static char (__pyx_k96[]) = "sigma <= 0.0";
+static char (__pyx_k119[]) = "sigma <= 0";
+static char (__pyx_k120[]) = "sigma <= 0.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_lognormal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_lognormal[] = "Log-normal distribution.\n        \n        Note that the mean parameter is not the mean of this distribution, but \n        the underlying normal distribution.\n        \n            lognormal(mean, sigma) <=> exp(normal(mean, sigma))\n        \n        lognormal(mean=0.0, sigma=1.0, size=None)\n        ";
@@ -4815,12 +5860,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_omean;
   PyArrayObject *__pyx_v_osigma;
+  double __pyx_v_fmean;
+  double __pyx_v_fsigma;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"mean","sigma","size",0};
   __pyx_v_mean = __pyx_k43;
   __pyx_v_sigma = __pyx_k44;
@@ -4833,74 +5880,115 @@
   __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_osigma = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":927 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1121 */
+  __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1122 */
+  __pyx_v_fsigma = PyFloat_AsDouble(__pyx_v_sigma);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1124 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1125 */
+    __pyx_1 = (__pyx_v_fsigma <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1126 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+      Py_INCREF(__pyx_k119p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k119p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1127 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_fmean,__pyx_v_fsigma); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1129 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1131 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1131; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_omean));
-  __pyx_v_omean = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_omean = ((PyArrayObject *)__pyx_3);
+  __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":928 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_sigma,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 928; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1132 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_sigma,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_osigma));
-  __pyx_v_osigma = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_osigma = ((PyArrayObject *)__pyx_4);
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":929 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1133 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_osigma));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_osigma));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_osigma));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":930 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
-    Py_INCREF(__pyx_k96p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k96p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1134 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+    Py_INCREF(__pyx_k120p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k120p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":931 */
-  __pyx_4 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_omean,__pyx_v_osigma); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1135 */
+  __pyx_5 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_lognormal,__pyx_v_size,__pyx_v_omean,__pyx_v_osigma); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.lognormal");
   __pyx_r = 0;
   __pyx_L0:;
@@ -4913,9 +6001,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k97p;
+static PyObject *__pyx_k121p;
+static PyObject *__pyx_k122p;
 
-static char (__pyx_k97[]) = "scale <= 0.0";
+static char (__pyx_k121[]) = "scale <= 0";
+static char (__pyx_k122[]) = "scale <= 0.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_rayleigh(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_rayleigh[] = "Rayleigh distribution.\n        \n        rayleigh(scale=1.0, size=None)\n        ";
@@ -4923,12 +6013,13 @@
   PyObject *__pyx_v_scale = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"scale","size",0};
   __pyx_v_scale = __pyx_k46;
   __pyx_v_size = __pyx_k47;
@@ -4938,67 +6029,105 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":939 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 939; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1145 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1147 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1148 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1149 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+      Py_INCREF(__pyx_k121p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k121p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1150 */
+    __pyx_2 = __pyx_f_6mtrand_cont1_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1152 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1154 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1154; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":940 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1155 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 940; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1155; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":941 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}
-    Py_INCREF(__pyx_k97p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k97p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1156 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+    Py_INCREF(__pyx_k122p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k122p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 941; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1156; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":942 */
-  __pyx_4 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_oscale); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 942; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1157 */
+  __pyx_5 = __pyx_f_6mtrand_cont1_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_rayleigh,__pyx_v_size,__pyx_v_oscale); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1157; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.rayleigh");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5009,11 +6138,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k98p;
-static PyObject *__pyx_k99p;
+static PyObject *__pyx_k123p;
+static PyObject *__pyx_k124p;
+static PyObject *__pyx_k125p;
+static PyObject *__pyx_k126p;
 
-static char (__pyx_k98[]) = "mean <= 0.0";
-static char (__pyx_k99[]) = "scale <= 0.0";
+static char (__pyx_k123[]) = "mean <= 0";
+static char (__pyx_k124[]) = "scale <= 0";
+static char (__pyx_k125[]) = "mean <= 0.0";
+static char (__pyx_k126[]) = "scale <= 0.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_wald(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_wald[] = "Wald (inverse Gaussian) distribution.\n        \n        wald(mean, scale, size=None)\n        ";
@@ -5023,12 +6156,14 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_omean;
   PyArrayObject *__pyx_v_oscale;
+  double __pyx_v_fmean;
+  double __pyx_v_fscale;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"mean","scale","size",0};
   __pyx_v_size = __pyx_k48;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mean, &__pyx_v_scale, &__pyx_v_size)) return 0;
@@ -5039,112 +6174,172 @@
   __pyx_v_omean = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oscale = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":951 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1167 */
+  __pyx_v_fmean = PyFloat_AsDouble(__pyx_v_mean);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1168 */
+  __pyx_v_fscale = PyFloat_AsDouble(__pyx_v_scale);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1169 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1170 */
+    __pyx_1 = (__pyx_v_fmean <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1171 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; goto __pyx_L1;}
+      Py_INCREF(__pyx_k123p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k123p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1171; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1172 */
+    __pyx_1 = (__pyx_v_fscale <= 0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1173 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;}
+      Py_INCREF(__pyx_k124p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k124p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1174 */
+    __pyx_2 = __pyx_f_6mtrand_cont2_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_fmean,__pyx_v_fscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1176 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1177 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_mean,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_omean));
-  __pyx_v_omean = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_omean = ((PyArrayObject *)__pyx_3);
+  __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":952 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
-  if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1178 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_scale,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
+  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_6mtrand_ndarray)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
   Py_DECREF(((PyObject *)__pyx_v_oscale));
-  __pyx_v_oscale = ((PyArrayObject *)__pyx_1);
-  __pyx_1 = 0;
+  __pyx_v_oscale = ((PyArrayObject *)__pyx_4);
+  __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":953 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1179 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_omean));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_omean));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_omean));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 953; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":954 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}
-    Py_INCREF(__pyx_k98p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k98p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1180 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;}
+    Py_INCREF(__pyx_k125p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k125p);
+    __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1180; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyFloat_FromDouble(0.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_v_oscale));
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(0.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_oscale));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":956 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}
-    Py_INCREF(__pyx_k99p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k99p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1182 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;}
+    Py_INCREF(__pyx_k126p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k126p);
+    __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 956; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_2, 0, 0);
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1182; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L2:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":957 */
-  __pyx_2 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_omean,__pyx_v_oscale); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 957; goto __pyx_L1;}
-  __pyx_r = __pyx_2;
-  __pyx_2 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1183 */
+  __pyx_3 = __pyx_f_6mtrand_cont2_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_wald,__pyx_v_size,__pyx_v_omean,__pyx_v_oscale); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.wald");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5160,13 +6355,19 @@
 static PyObject *__pyx_n_greater;
 static PyObject *__pyx_n_equal;
 
-static PyObject *__pyx_k100p;
-static PyObject *__pyx_k101p;
-static PyObject *__pyx_k102p;
+static PyObject *__pyx_k127p;
+static PyObject *__pyx_k128p;
+static PyObject *__pyx_k129p;
+static PyObject *__pyx_k130p;
+static PyObject *__pyx_k131p;
+static PyObject *__pyx_k132p;
 
-static char (__pyx_k100[]) = "left > mode";
-static char (__pyx_k101[]) = "mode > right";
-static char (__pyx_k102[]) = "left == right";
+static char (__pyx_k127[]) = "left > mode";
+static char (__pyx_k128[]) = "mode > right";
+static char (__pyx_k129[]) = "left == right";
+static char (__pyx_k130[]) = "left > mode";
+static char (__pyx_k131[]) = "mode > right";
+static char (__pyx_k132[]) = "left == right";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_triangular(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_triangular[] = "Triangular distribution starting at left, peaking at mode, and \n        ending at right (left <= mode <= right).\n        \n        triangular(left, mode, right, size=None)\n        ";
@@ -5178,12 +6379,15 @@
   PyArrayObject *__pyx_v_oleft;
   PyArrayObject *__pyx_v_omode;
   PyArrayObject *__pyx_v_oright;
+  double __pyx_v_fleft;
+  double __pyx_v_fmode;
+  double __pyx_v_fright;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"left","mode","right","size",0};
   __pyx_v_size = __pyx_k49;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|O", __pyx_argnames, &__pyx_v_left, &__pyx_v_mode, &__pyx_v_right, &__pyx_v_size)) return 0;
@@ -5196,160 +6400,242 @@
   __pyx_v_omode = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_oright = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":968 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_left,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 968; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1196 */
+  __pyx_v_fleft = PyFloat_AsDouble(__pyx_v_left);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1197 */
+  __pyx_v_fright = PyFloat_AsDouble(__pyx_v_right);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1198 */
+  __pyx_v_fmode = PyFloat_AsDouble(__pyx_v_mode);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1199 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1200 */
+    __pyx_1 = (__pyx_v_fleft > __pyx_v_fmode);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1201 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
+      Py_INCREF(__pyx_k127p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k127p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1201; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1202 */
+    __pyx_1 = (__pyx_v_fmode > __pyx_v_fright);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1203 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
+      Py_INCREF(__pyx_k128p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k128p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1203; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1204 */
+    __pyx_1 = (__pyx_v_fleft == __pyx_v_fright);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1205 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; goto __pyx_L1;}
+      Py_INCREF(__pyx_k129p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k129p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1205; goto __pyx_L1;}
+      goto __pyx_L5;
+    }
+    __pyx_L5:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1206 */
+    __pyx_2 = __pyx_f_6mtrand_cont3_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_fleft,__pyx_v_fmode,__pyx_v_fright); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1206; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1209 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1210 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_left,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1210; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oleft));
-  __pyx_v_oleft = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oleft = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":969 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_mode,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1211 */
+  __pyx_4 = PyArray_FROM_OTF(__pyx_v_mode,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
   Py_DECREF(((PyObject *)__pyx_v_omode));
-  __pyx_v_omode = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_omode = ((PyArrayObject *)__pyx_4);
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":970 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_right,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1212 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_right,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
   Py_DECREF(((PyObject *)__pyx_v_oright));
-  __pyx_v_oright = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oright = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":972 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1214 */
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oleft));
-  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_oleft));
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_oleft));
   Py_INCREF(((PyObject *)__pyx_v_omode));
-  PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_v_omode));
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_omode));
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 972; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1214; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":973 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; goto __pyx_L1;}
-    Py_INCREF(__pyx_k100p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k100p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1215 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; goto __pyx_L1;}
+    Py_INCREF(__pyx_k130p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k130p);
+    __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 973; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1215; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L2:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":974 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1216 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_omode));
-  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_omode));
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_omode));
   Py_INCREF(((PyObject *)__pyx_v_oright));
-  PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_v_oright));
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright));
+  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
+  __pyx_4 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":975 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
-    Py_INCREF(__pyx_k101p);
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k101p);
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1217 */
+    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; goto __pyx_L1;}
+    Py_INCREF(__pyx_k131p);
+    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k131p);
+    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; goto __pyx_L1;}
     Py_DECREF(__pyx_4); __pyx_4 = 0;
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1217; goto __pyx_L1;}
+    goto __pyx_L7;
   }
-  __pyx_L3:;
+  __pyx_L7:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":976 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_4, __pyx_n_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1218 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oleft));
-  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_oleft));
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_oleft));
   Py_INCREF(((PyObject *)__pyx_v_oright));
-  PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_v_oright));
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_oright));
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 976; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1218; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":977 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; goto __pyx_L1;}
-    Py_INCREF(__pyx_k102p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k102p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1219 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; goto __pyx_L1;}
+    Py_INCREF(__pyx_k132p);
+    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k132p);
+    __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 977; goto __pyx_L1;}
-    goto __pyx_L4;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; goto __pyx_L1;}
+    goto __pyx_L8;
   }
-  __pyx_L4:;
+  __pyx_L8:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":978 */
-  __pyx_1 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_oleft,__pyx_v_omode,__pyx_v_oright); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 978; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1220 */
+  __pyx_2 = __pyx_f_6mtrand_cont3_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_triangular,__pyx_v_size,__pyx_v_oleft,__pyx_v_omode,__pyx_v_oright); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1220; goto __pyx_L1;}
+  __pyx_r = __pyx_2;
+  __pyx_2 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.triangular");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5364,14 +6650,22 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k103p;
-static PyObject *__pyx_k104p;
-static PyObject *__pyx_k105p;
+static PyObject *__pyx_n_PyInt_AsLong;
 
-static char (__pyx_k103[]) = "n <= 0";
-static char (__pyx_k104[]) = "p < 0";
-static char (__pyx_k105[]) = "p > 1";
+static PyObject *__pyx_k133p;
+static PyObject *__pyx_k134p;
+static PyObject *__pyx_k135p;
+static PyObject *__pyx_k136p;
+static PyObject *__pyx_k137p;
+static PyObject *__pyx_k138p;
 
+static char (__pyx_k133[]) = "n <= 0";
+static char (__pyx_k134[]) = "p < 0";
+static char (__pyx_k135[]) = "p > 1";
+static char (__pyx_k136[]) = "n <= 0";
+static char (__pyx_k137[]) = "p < 0";
+static char (__pyx_k138[]) = "p > 1";
+
 static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_binomial[] = "Binomial distribution of n trials and p probability of success.\n\n        binomial(n, p, size=None) -> random values\n        ";
 static PyObject *__pyx_f_6mtrand_11RandomState_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
@@ -5380,12 +6674,15 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_on;
   PyArrayObject *__pyx_v_op;
+  long __pyx_v_ln;
+  double __pyx_v_fp;
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
-  PyObject *__pyx_4 = 0;
+  long __pyx_4;
   int __pyx_5;
+  PyObject *__pyx_6 = 0;
   static char *__pyx_argnames[] = {"n","p","size",0};
   __pyx_v_size = __pyx_k50;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;
@@ -5396,147 +6693,232 @@
   __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":989 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_on));
-  __pyx_v_on = ((PyArrayObject *)__pyx_1);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1233 */
+  __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1234 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_PyInt_AsLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_n);
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_v_ln = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":990 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1235 */
+  __pyx_5 = (!PyErr_Occurred());
+  if (__pyx_5) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1236 */
+    __pyx_5 = (__pyx_v_ln <= 0);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1237 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; goto __pyx_L1;}
+      Py_INCREF(__pyx_k133p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k133p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1237; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1238 */
+    __pyx_5 = (__pyx_v_fp < 0);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1239 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; goto __pyx_L1;}
+      Py_INCREF(__pyx_k134p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k134p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1239; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_5 = (__pyx_v_fp > 1);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1241 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;}
+      Py_INCREF(__pyx_k135p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k135p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1242 */
+    __pyx_1 = __pyx_f_6mtrand_discnp_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_ln,__pyx_v_fp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1242; goto __pyx_L1;}
+    __pyx_r = __pyx_1;
+    __pyx_1 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1244 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1246 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1246; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  Py_DECREF(((PyObject *)__pyx_v_on));
+  __pyx_v_on = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1247 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1247; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_op));
-  __pyx_v_op = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_op = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":991 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1248 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_6, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  Py_INCREF(__pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_6); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1248; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":992 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; goto __pyx_L1;}
-    Py_INCREF(__pyx_k103p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k103p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1249 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;}
+    Py_INCREF(__pyx_k136p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k136p);
+    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 992; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1249; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L2:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":993 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1250 */
+  __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
+  __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
   Py_INCREF(__pyx_v_p);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 993; goto __pyx_L1;}
+  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1250; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":994 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; goto __pyx_L1;}
-    Py_INCREF(__pyx_k104p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k104p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; goto __pyx_L1;}
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1251 */
+    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;}
+    Py_INCREF(__pyx_k137p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k137p);
+    __pyx_1 = PyObject_CallObject(__pyx_6, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;}
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1251; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":995 */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1252 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  __pyx_6 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_greater); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
   Py_INCREF(__pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p);
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_6, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_3); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1252; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":996 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
-    Py_INCREF(__pyx_k105p);
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k105p);
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1253 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; goto __pyx_L1;}
+    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; goto __pyx_L1;}
+    Py_INCREF(__pyx_k138p);
+    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_k138p);
+    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 996; goto __pyx_L1;}
-    goto __pyx_L4;
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1253; goto __pyx_L1;}
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":997 */
-  __pyx_1 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 997; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1254 */
+  __pyx_3 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1254; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
@@ -5545,7 +6927,7 @@
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_6);
   __Pyx_AddTraceback("mtrand.RandomState.binomial");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5558,13 +6940,19 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k106p;
-static PyObject *__pyx_k107p;
-static PyObject *__pyx_k108p;
+static PyObject *__pyx_k139p;
+static PyObject *__pyx_k140p;
+static PyObject *__pyx_k141p;
+static PyObject *__pyx_k142p;
+static PyObject *__pyx_k143p;
+static PyObject *__pyx_k144p;
 
-static char (__pyx_k106[]) = "n <= 0";
-static char (__pyx_k107[]) = "p < 0";
-static char (__pyx_k108[]) = "p > 1";
+static char (__pyx_k139[]) = "n <= 0";
+static char (__pyx_k140[]) = "p < 0";
+static char (__pyx_k141[]) = "p > 1";
+static char (__pyx_k142[]) = "n <= 0";
+static char (__pyx_k143[]) = "p < 0";
+static char (__pyx_k144[]) = "p > 1";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_negative_binomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_negative_binomial[] = "Negative Binomial distribution.\n\n        negative_binomial(n, p, size=None) -> random values\n        ";
@@ -5574,12 +6962,15 @@
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_on;
   PyArrayObject *__pyx_v_op;
+  long __pyx_v_ln;
+  double __pyx_v_fp;
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
-  PyObject *__pyx_4 = 0;
+  long __pyx_4;
   int __pyx_5;
+  PyObject *__pyx_6 = 0;
   static char *__pyx_argnames[] = {"n","p","size",0};
   __pyx_v_size = __pyx_k51;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_n, &__pyx_v_p, &__pyx_v_size)) return 0;
@@ -5590,147 +6981,232 @@
   __pyx_v_on = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1006 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1006; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_on));
-  __pyx_v_on = ((PyArrayObject *)__pyx_1);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1266 */
+  __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1267 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_PyInt_AsLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_n);
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_v_ln = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1007 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1007; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1268 */
+  __pyx_5 = (!PyErr_Occurred());
+  if (__pyx_5) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1269 */
+    __pyx_5 = (__pyx_v_ln <= 0);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1270 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; goto __pyx_L1;}
+      Py_INCREF(__pyx_k139p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k139p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1270; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1271 */
+    __pyx_5 = (__pyx_v_fp < 0);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1272 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; goto __pyx_L1;}
+      Py_INCREF(__pyx_k140p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k140p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1272; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_5 = (__pyx_v_fp > 1);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1274 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; goto __pyx_L1;}
+      Py_INCREF(__pyx_k141p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k141p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1274; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1275 */
+    __pyx_1 = __pyx_f_6mtrand_discnp_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_ln,__pyx_v_fp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1275; goto __pyx_L1;}
+    __pyx_r = __pyx_1;
+    __pyx_1 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1278 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1280 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_n,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1280; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  Py_DECREF(((PyObject *)__pyx_v_on));
+  __pyx_v_on = ((PyArrayObject *)__pyx_2);
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1281 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1281; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_op));
-  __pyx_v_op = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_op = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1008 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1282 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_6, 0, __pyx_v_n);
+  PyTuple_SET_ITEM(__pyx_6, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  Py_INCREF(__pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_n);
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1008; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_6); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1282; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1009 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; goto __pyx_L1;}
-    Py_INCREF(__pyx_k106p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k106p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1283 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; goto __pyx_L1;}
+    Py_INCREF(__pyx_k142p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k142p);
+    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; goto __pyx_L1;}
-    goto __pyx_L2;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1283; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L2:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1010 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1284 */
+  __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
+  __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
   Py_INCREF(__pyx_v_p);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; goto __pyx_L1;}
+  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1284; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1011 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
-    Py_INCREF(__pyx_k107p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k107p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1285 */
+    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; goto __pyx_L1;}
+    Py_INCREF(__pyx_k143p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k143p);
+    __pyx_1 = PyObject_CallObject(__pyx_6, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; goto __pyx_L1;}
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1011; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1285; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1012 */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1286 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  __pyx_6 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_greater); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
   Py_INCREF(__pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_p);
-  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_p);
+  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_6, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_4, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_3); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1286; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1012; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1013 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; goto __pyx_L1;}
-    Py_INCREF(__pyx_k108p);
-    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k108p);
-    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1287 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; goto __pyx_L1;}
+    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; goto __pyx_L1;}
+    Py_INCREF(__pyx_k144p);
+    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_k144p);
+    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1013; goto __pyx_L1;}
-    goto __pyx_L4;
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1287; goto __pyx_L1;}
+    goto __pyx_L7;
   }
-  __pyx_L4:;
+  __pyx_L7:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1014 */
-  __pyx_1 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1288 */
+  __pyx_3 = __pyx_f_6mtrand_discnp_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_negative_binomial,__pyx_v_size,__pyx_v_on,__pyx_v_op); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1288; goto __pyx_L1;}
+  __pyx_r = __pyx_3;
+  __pyx_3 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
@@ -5739,7 +7215,7 @@
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_6);
   __Pyx_AddTraceback("mtrand.RandomState.negative_binomial");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5752,9 +7228,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k109p;
+static PyObject *__pyx_k145p;
+static PyObject *__pyx_k146p;
 
-static char (__pyx_k109[]) = "lam < 0";
+static char (__pyx_k145[]) = "lam < 0";
+static char (__pyx_k146[]) = "lam < 0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_poisson(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_poisson[] = "Poisson distribution.\n\n        poisson(lam=1.0, size=None) -> random values\n        ";
@@ -5762,12 +7240,13 @@
   PyObject *__pyx_v_lam = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_olam;
+  double __pyx_v_flam;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"lam","size",0};
   __pyx_v_lam = __pyx_k52;
   __pyx_v_size = __pyx_k53;
@@ -5777,67 +7256,108 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_olam = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1023 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_lam,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1023; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1298 */
+  __pyx_v_flam = PyFloat_AsDouble(__pyx_v_lam);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1299 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1300 */
+    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_v_lam, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1300; goto __pyx_L1;}
+    __pyx_1 = __pyx_1 < 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1301 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; goto __pyx_L1;}
+      Py_INCREF(__pyx_k145p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k145p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1301; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1302 */
+    __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_flam); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1302; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1304 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1306 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_lam,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_olam));
-  __pyx_v_olam = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_olam = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1024 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1307 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_olam));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_olam));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_olam));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1024; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1307; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1025 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; goto __pyx_L1;}
-    Py_INCREF(__pyx_k109p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k109p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1308 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; goto __pyx_L1;}
+    Py_INCREF(__pyx_k146p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k146p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1025; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1308; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1026 */
-  __pyx_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_olam); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1026; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1309 */
+  __pyx_5 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_poisson,__pyx_v_size,__pyx_v_olam); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1309; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.poisson");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5848,9 +7368,11 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k110p;
+static PyObject *__pyx_k147p;
+static PyObject *__pyx_k148p;
 
-static char (__pyx_k110[]) = "a <= 1.0";
+static char (__pyx_k147[]) = "a <= 1.0";
+static char (__pyx_k148[]) = "a <= 1.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_zipf(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_zipf[] = "Zipf distribution.\n        \n        zipf(a, size=None)\n        ";
@@ -5858,12 +7380,13 @@
   PyObject *__pyx_v_a = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_oa;
+  double __pyx_v_fa;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"a","size",0};
   __pyx_v_size = __pyx_k54;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_a, &__pyx_v_size)) return 0;
@@ -5872,67 +7395,105 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_oa = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1034 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1034; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1319 */
+  __pyx_v_fa = PyFloat_AsDouble(__pyx_v_a);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1320 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1321 */
+    __pyx_1 = (__pyx_v_fa <= 1.0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1322 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; goto __pyx_L1;}
+      Py_INCREF(__pyx_k147p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k147p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1322; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1323 */
+    __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_fa); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1323; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1325 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1327 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_a,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1327; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_oa));
-  __pyx_v_oa = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_oa = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1035 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less_equal); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(1.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1328 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less_equal); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(1.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_oa));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_oa));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1035; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1036 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
-    Py_INCREF(__pyx_k110p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k110p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1329 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    Py_INCREF(__pyx_k148p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k148p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1036; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    goto __pyx_L4;
   }
-  __pyx_L2:;
+  __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1037 */
-  __pyx_4 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_oa); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1330 */
+  __pyx_5 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_zipf,__pyx_v_size,__pyx_v_oa); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1330; goto __pyx_L1;}
+  __pyx_r = __pyx_5;
+  __pyx_5 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.zipf");
   __pyx_r = 0;
   __pyx_L0:;
@@ -5943,11 +7504,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k111p;
-static PyObject *__pyx_k112p;
+static PyObject *__pyx_k149p;
+static PyObject *__pyx_k150p;
+static PyObject *__pyx_k151p;
+static PyObject *__pyx_k152p;
 
-static char (__pyx_k111[]) = "p < 0.0";
-static char (__pyx_k112[]) = "p > 1.0";
+static char (__pyx_k149[]) = "p < 0.0";
+static char (__pyx_k150[]) = "p > 1.0";
+static char (__pyx_k151[]) = "p < 0.0";
+static char (__pyx_k152[]) = "p > 1.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_geometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_geometric[] = "Geometric distribution with p being the probability of \"success\" on\n        an individual trial.\n        \n        geometric(p, size=None)\n        ";
@@ -5955,12 +7520,13 @@
   PyObject *__pyx_v_p = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_op;
+  double __pyx_v_fp;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"p","size",0};
   __pyx_v_size = __pyx_k55;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;
@@ -5969,97 +7535,154 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1046 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1341 */
+  __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1342 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1343 */
+    __pyx_1 = (__pyx_v_fp < 0.0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1344 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+      Py_INCREF(__pyx_k149p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k149p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1345 */
+    __pyx_1 = (__pyx_v_fp > 1.0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1346 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+      Py_INCREF(__pyx_k150p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k150p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1347 */
+    __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1349 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1352 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_op));
-  __pyx_v_op = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_op = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1047 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1353 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_op));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1048 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; goto __pyx_L1;}
-    Py_INCREF(__pyx_k111p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k111p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1354 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+    Py_INCREF(__pyx_k151p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k151p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L2:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1049 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1355 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
+  __pyx_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_op));
   PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1049; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1050 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; goto __pyx_L1;}
-    Py_INCREF(__pyx_k112p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k112p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1356 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+    Py_INCREF(__pyx_k152p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k152p);
+    __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_4, 0, 0);
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1051 */
-  __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_op); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1357 */
+  __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_geometric,__pyx_v_size,__pyx_v_op); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; goto __pyx_L1;}
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   goto __pyx_L0;
@@ -6067,10 +7690,10 @@
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.geometric");
   __pyx_r = 0;
   __pyx_L0:;
@@ -6083,15 +7706,23 @@
 
 static PyObject *__pyx_n_add;
 
-static PyObject *__pyx_k113p;
-static PyObject *__pyx_k114p;
-static PyObject *__pyx_k115p;
-static PyObject *__pyx_k116p;
+static PyObject *__pyx_k153p;
+static PyObject *__pyx_k154p;
+static PyObject *__pyx_k155p;
+static PyObject *__pyx_k156p;
+static PyObject *__pyx_k157p;
+static PyObject *__pyx_k158p;
+static PyObject *__pyx_k159p;
+static PyObject *__pyx_k160p;
 
-static char (__pyx_k113[]) = "ngood < 1";
-static char (__pyx_k114[]) = "nbad < 1";
-static char (__pyx_k115[]) = "ngood + nbad < nsample";
-static char (__pyx_k116[]) = "nsample < 1";
+static char (__pyx_k153[]) = "ngood < 1";
+static char (__pyx_k154[]) = "nbad < 1";
+static char (__pyx_k155[]) = "nsample < 1";
+static char (__pyx_k156[]) = "ngood + nbad < nsample";
+static char (__pyx_k157[]) = "ngood < 1";
+static char (__pyx_k158[]) = "nbad < 1";
+static char (__pyx_k159[]) = "nsample < 1";
+static char (__pyx_k160[]) = "ngood + nbad < nsample";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_hypergeometric(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_hypergeometric[] = "Hypergeometric distribution.\n        \n        Consider an urn with ngood \"good\" balls and nbad \"bad\" balls. If one \n        were to draw nsample balls from the urn without replacement, then \n        the hypergeometric distribution describes the distribution of \"good\" \n        balls in the sample.\n        \n        hypergeometric(ngood, nbad, nsample, size=None)        \n        ";
@@ -6103,13 +7734,17 @@
   PyArrayObject *__pyx_v_ongood;
   PyArrayObject *__pyx_v_onbad;
   PyArrayObject *__pyx_v_onsample;
+  long __pyx_v_lngood;
+  long __pyx_v_lnbad;
+  long __pyx_v_lnsample;
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
-  PyObject *__pyx_4 = 0;
+  long __pyx_4;
   int __pyx_5;
   PyObject *__pyx_6 = 0;
+  PyObject *__pyx_7 = 0;
   static char *__pyx_argnames[] = {"ngood","nbad","nsample","size",0};
   __pyx_v_size = __pyx_k56;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|O", __pyx_argnames, &__pyx_v_ngood, &__pyx_v_nbad, &__pyx_v_nsample, &__pyx_v_size)) return 0;
@@ -6122,205 +7757,345 @@
   __pyx_v_onbad = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
   __pyx_v_onsample = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1067 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_ngood,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1067; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_ongood));
-  __pyx_v_ongood = ((PyArrayObject *)__pyx_1);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1372 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_PyInt_AsLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_ngood);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_ngood);
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_v_lngood = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1068 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_nbad,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1068; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_onbad));
-  __pyx_v_onbad = ((PyArrayObject *)__pyx_1);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1373 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_PyInt_AsLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_nbad);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_nbad);
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_v_lnbad = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1069 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_nsample,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1069; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
-  Py_DECREF(((PyObject *)__pyx_v_onsample));
-  __pyx_v_onsample = ((PyArrayObject *)__pyx_1);
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1374 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_PyInt_AsLong); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_nsample);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_nsample);
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1070 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_ongood));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_ongood));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1070; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_v_lnsample = __pyx_4;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1375 */
+  __pyx_5 = (!PyErr_Occurred());
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1071 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;}
-    Py_INCREF(__pyx_k113p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k113p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1376 */
+    __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_v_ngood, __pyx_1, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; goto __pyx_L1;}
+    __pyx_5 = __pyx_5 < 0;
     Py_DECREF(__pyx_1); __pyx_1 = 0;
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1377 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+      Py_INCREF(__pyx_k153p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k153p);
+      __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_1, 0, 0);
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1378 */
+    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_v_nbad, __pyx_2, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1378; goto __pyx_L1;}
+    __pyx_5 = __pyx_5 < 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1379 */
+      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+      __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+      Py_INCREF(__pyx_k154p);
+      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k154p);
+      __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      __Pyx_Raise(__pyx_2, 0, 0);
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1380 */
+    __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_v_nsample, __pyx_3, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
+    __pyx_5 = __pyx_5 < 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1071; goto __pyx_L1;}
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1381 */
+      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+      Py_INCREF(__pyx_k155p);
+      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k155p);
+      __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      __Pyx_Raise(__pyx_3, 0, 0);
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+      goto __pyx_L5;
+    }
+    __pyx_L5:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1382 */
+    __pyx_1 = PyNumber_Add(__pyx_v_ngood, __pyx_v_nbad); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_1, __pyx_v_nsample, &__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1382; goto __pyx_L1;}
+    __pyx_5 = __pyx_5 < 0;
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    if (__pyx_5) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1383 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+      Py_INCREF(__pyx_k156p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k156p);
+      __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_1, 0, 0);
+      Py_DECREF(__pyx_1); __pyx_1 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+      goto __pyx_L6;
+    }
+    __pyx_L6:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1384 */
+    __pyx_2 = __pyx_f_6mtrand_discnmN_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_lngood,__pyx_v_lnbad,__pyx_v_lnsample); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1072 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1388 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1390 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_ngood,NPY_LONG,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1390; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+  Py_DECREF(((PyObject *)__pyx_v_ongood));
+  __pyx_v_ongood = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1391 */
+  __pyx_1 = PyArray_FROM_OTF(__pyx_v_nbad,NPY_LONG,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1391; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  Py_DECREF(((PyObject *)__pyx_v_onbad));
+  __pyx_v_onbad = ((PyArrayObject *)__pyx_1);
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1392 */
+  __pyx_2 = PyArray_FROM_OTF(__pyx_v_nsample,NPY_LONG,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1392; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+  Py_DECREF(((PyObject *)__pyx_v_onsample));
+  __pyx_v_onsample = ((PyArrayObject *)__pyx_2);
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_onbad));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_onbad));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1393 */
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_ongood));
+  PyTuple_SET_ITEM(__pyx_6, 0, ((PyObject *)__pyx_v_ongood));
+  PyTuple_SET_ITEM(__pyx_6, 1, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_6); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1393; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1073 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
-    Py_INCREF(__pyx_k114p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k114p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1394 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; goto __pyx_L1;}
+    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; goto __pyx_L1;}
+    Py_INCREF(__pyx_k157p);
+    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k157p);
+    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; goto __pyx_L1;}
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1073; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1394; goto __pyx_L1;}
+    goto __pyx_L7;
   }
-  __pyx_L3:;
+  __pyx_L7:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1074 */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1395 */
+  __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_6, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)__pyx_v_ongood));
-  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ongood));
+  __pyx_6 = PyInt_FromLong(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_onbad));
-  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onbad));
-  __pyx_6 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_onbad));
+  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_6);
+  __pyx_6 = 0;
+  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_6);
-  Py_INCREF(((PyObject *)__pyx_v_onsample));
-  PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_v_onsample));
-  __pyx_6 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_1); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1395; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
-  __pyx_2 = 0;
-  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  Py_DECREF(__pyx_6); __pyx_6 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_3); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1075 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
-    Py_INCREF(__pyx_k115p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k115p);
-    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1396 */
+    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; goto __pyx_L1;}
+    Py_INCREF(__pyx_k158p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k158p);
+    __pyx_3 = PyObject_CallObject(__pyx_6, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; goto __pyx_L1;}
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_4, 0, 0);
-    Py_DECREF(__pyx_4); __pyx_4 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1075; goto __pyx_L1;}
-    goto __pyx_L4;
+    __Pyx_Raise(__pyx_3, 0, 0);
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1396; goto __pyx_L1;}
+    goto __pyx_L8;
   }
-  __pyx_L4:;
+  __pyx_L8:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1076 */
-  __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
-  Py_DECREF(__pyx_6); __pyx_6 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1397 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  __pyx_6 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
-  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_onsample));
-  PyTuple_SET_ITEM(__pyx_6, 0, ((PyObject *)__pyx_v_onsample));
-  PyTuple_SET_ITEM(__pyx_6, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_onsample));
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
+  __pyx_1 = 0;
+  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
+  __pyx_1 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_6, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
   Py_DECREF(__pyx_6); __pyx_6 = 0;
-  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; goto __pyx_L1;}
+  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1397; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1077 */
-    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; goto __pyx_L1;}
-    Py_INCREF(__pyx_k116p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k116p);
-    __pyx_3 = PyObject_CallObject(__pyx_6, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1398 */
+    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;}
+    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;}
+    Py_INCREF(__pyx_k159p);
+    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_k159p);
+    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;}
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_6); __pyx_6 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; goto __pyx_L1;}
-    goto __pyx_L5;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1398; goto __pyx_L1;}
+    goto __pyx_L9;
   }
-  __pyx_L5:;
+  __pyx_L9:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1078 */
-  __pyx_4 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ongood,__pyx_v_onbad,__pyx_v_onsample); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; goto __pyx_L1;}
-  __pyx_r = __pyx_4;
-  __pyx_4 = 0;
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1399 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_6, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  __pyx_6 = PyObject_GetAttr(__pyx_2, __pyx_n_add); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)__pyx_v_ongood));
+  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_ongood));
+  Py_INCREF(((PyObject *)__pyx_v_onbad));
+  PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)__pyx_v_onbad));
+  __pyx_7 = PyObject_CallObject(__pyx_6, __pyx_2); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_6, 0, __pyx_7);
+  Py_INCREF(((PyObject *)__pyx_v_onsample));
+  PyTuple_SET_ITEM(__pyx_6, 1, ((PyObject *)__pyx_v_onsample));
+  __pyx_7 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  Py_DECREF(__pyx_6); __pyx_6 = 0;
+  __pyx_7 = PyTuple_New(1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2);
+  __pyx_2 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_7); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_7); __pyx_7 = 0;
+  __pyx_5 = PyObject_IsTrue(__pyx_3); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1399; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  if (__pyx_5) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1400 */
+    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; goto __pyx_L1;}
+    Py_INCREF(__pyx_k160p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k160p);
+    __pyx_1 = PyObject_CallObject(__pyx_6, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; goto __pyx_L1;}
+    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    Py_DECREF(__pyx_2); __pyx_2 = 0;
+    __Pyx_Raise(__pyx_1, 0, 0);
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1400; goto __pyx_L1;}
+    goto __pyx_L10;
+  }
+  __pyx_L10:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1401 */
+  __pyx_7 = __pyx_f_6mtrand_discnmN_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_hypergeometric,__pyx_v_size,__pyx_v_ongood,__pyx_v_onbad,__pyx_v_onsample); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1401; goto __pyx_L1;}
+  __pyx_r = __pyx_7;
+  __pyx_7 = 0;
   goto __pyx_L0;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
@@ -6329,8 +8104,8 @@
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_4);
   Py_XDECREF(__pyx_6);
+  Py_XDECREF(__pyx_7);
   __Pyx_AddTraceback("mtrand.RandomState.hypergeometric");
   __pyx_r = 0;
   __pyx_L0:;
@@ -6345,11 +8120,15 @@
   return __pyx_r;
 }
 
-static PyObject *__pyx_k117p;
-static PyObject *__pyx_k118p;
+static PyObject *__pyx_k161p;
+static PyObject *__pyx_k162p;
+static PyObject *__pyx_k163p;
+static PyObject *__pyx_k164p;
 
-static char (__pyx_k117[]) = "p < 0.0";
-static char (__pyx_k118[]) = "p > 1.0";
+static char (__pyx_k161[]) = "p < 0.0";
+static char (__pyx_k162[]) = "p > 1.0";
+static char (__pyx_k163[]) = "p < 0.0";
+static char (__pyx_k164[]) = "p > 1.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_logseries(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_logseries[] = "Logarithmic series distribution.\n        \n        logseries(p, size=None)\n        ";
@@ -6357,12 +8136,13 @@
   PyObject *__pyx_v_p = 0;
   PyObject *__pyx_v_size = 0;
   PyArrayObject *__pyx_v_op;
+  double __pyx_v_fp;
   PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
+  int __pyx_1;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  int __pyx_5;
+  PyObject *__pyx_5 = 0;
   static char *__pyx_argnames[] = {"p","size",0};
   __pyx_v_size = __pyx_k57;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O|O", __pyx_argnames, &__pyx_v_p, &__pyx_v_size)) return 0;
@@ -6371,97 +8151,154 @@
   Py_INCREF(__pyx_v_size);
   __pyx_v_op = ((PyArrayObject *)Py_None); Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1087 */
-  __pyx_1 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; goto __pyx_L1;}
-  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1412 */
+  __pyx_v_fp = PyFloat_AsDouble(__pyx_v_p);
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1413 */
+  __pyx_1 = (!PyErr_Occurred());
+  if (__pyx_1) {
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1414 */
+    __pyx_1 = (__pyx_v_fp < 0.0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1415 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
+      Py_INCREF(__pyx_k161p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k161p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1415; goto __pyx_L1;}
+      goto __pyx_L3;
+    }
+    __pyx_L3:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1416 */
+    __pyx_1 = (__pyx_v_fp > 1.0);
+    if (__pyx_1) {
+
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1417 */
+      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; goto __pyx_L1;}
+      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; goto __pyx_L1;}
+      Py_INCREF(__pyx_k162p);
+      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k162p);
+      __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; goto __pyx_L1;}
+      Py_DECREF(__pyx_2); __pyx_2 = 0;
+      Py_DECREF(__pyx_3); __pyx_3 = 0;
+      __Pyx_Raise(__pyx_4, 0, 0);
+      Py_DECREF(__pyx_4); __pyx_4 = 0;
+      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1417; goto __pyx_L1;}
+      goto __pyx_L4;
+    }
+    __pyx_L4:;
+
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1418 */
+    __pyx_2 = __pyx_f_6mtrand_discd_array_sc(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_fp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1418; goto __pyx_L1;}
+    __pyx_r = __pyx_2;
+    __pyx_2 = 0;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1420 */
+  PyErr_Clear();
+
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1422 */
+  __pyx_3 = PyArray_FROM_OTF(__pyx_v_p,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1422; goto __pyx_L1;}
+  Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
   Py_DECREF(((PyObject *)__pyx_v_op));
-  __pyx_v_op = ((PyArrayObject *)__pyx_1);
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_v_op = ((PyArrayObject *)__pyx_3);
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1088 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_n_less); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1423 */
+  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_less); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_4, 0, ((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_op));
+  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
-  __pyx_1 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1088; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
-  if (__pyx_5) {
+  __pyx_1 = PyObject_IsTrue(__pyx_5); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1423; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1089 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; goto __pyx_L1;}
-    Py_INCREF(__pyx_k117p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k117p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; goto __pyx_L1;}
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1424 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; goto __pyx_L1;}
+    Py_INCREF(__pyx_k163p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k163p);
+    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1089; goto __pyx_L1;}
-    goto __pyx_L2;
+    __Pyx_Raise(__pyx_4, 0, 0);
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1424; goto __pyx_L1;}
+    goto __pyx_L5;
   }
-  __pyx_L2:;
+  __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1090 */
-  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_n_any); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1425 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_any); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  Py_DECREF(__pyx_5); __pyx_5 = 0;
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_n_greater); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
+  __pyx_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
   Py_INCREF(((PyObject *)__pyx_v_op));
   PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_op));
-  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_5 = PyObject_CallObject(__pyx_4, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
-  __pyx_4 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_5);
+  __pyx_5 = 0;
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_2); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1090; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_1 = PyObject_IsTrue(__pyx_2); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1425; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  if (__pyx_5) {
+  if (__pyx_1) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1091 */
-    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; goto __pyx_L1;}
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; goto __pyx_L1;}
-    Py_INCREF(__pyx_k118p);
-    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k118p);
-    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1426 */
+    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; goto __pyx_L1;}
+    Py_INCREF(__pyx_k164p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k164p);
+    __pyx_4 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; goto __pyx_L1;}
+    Py_DECREF(__pyx_5); __pyx_5 = 0;
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __Pyx_Raise(__pyx_4, 0, 0);
     Py_DECREF(__pyx_4); __pyx_4 = 0;
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __Pyx_Raise(__pyx_3, 0, 0);
-    Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1091; goto __pyx_L1;}
-    goto __pyx_L3;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1426; goto __pyx_L1;}
+    goto __pyx_L6;
   }
-  __pyx_L3:;
+  __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1092 */
-  __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_op); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1427 */
+  __pyx_2 = __pyx_f_6mtrand_discd_array(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,rk_logseries,__pyx_v_size,__pyx_v_op); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1427; goto __pyx_L1;}
   __pyx_r = __pyx_2;
   __pyx_2 = 0;
   goto __pyx_L0;
@@ -6469,10 +8306,10 @@
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
+  Py_XDECREF(__pyx_5);
   __Pyx_AddTraceback("mtrand.RandomState.logseries");
   __pyx_r = 0;
   __pyx_L0:;
@@ -6495,15 +8332,15 @@
 static PyObject *__pyx_n_sqrt;
 static PyObject *__pyx_n_tuple;
 
-static PyObject *__pyx_k119p;
-static PyObject *__pyx_k120p;
-static PyObject *__pyx_k121p;
-static PyObject *__pyx_k122p;
+static PyObject *__pyx_k165p;
+static PyObject *__pyx_k166p;
+static PyObject *__pyx_k167p;
+static PyObject *__pyx_k168p;
 
-static char (__pyx_k119[]) = "mean must be 1 dimensional";
-static char (__pyx_k120[]) = "cov must be 2 dimensional and square";
-static char (__pyx_k121[]) = "mean and cov must have same length";
-static char (__pyx_k122[]) = "numpy.dual";
+static char (__pyx_k165[]) = "mean must be 1 dimensional";
+static char (__pyx_k166[]) = "cov must be 2 dimensional and square";
+static char (__pyx_k167[]) = "mean and cov must have same length";
+static char (__pyx_k168[]) = "numpy.dual";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_multivariate_normal(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_multivariate_normal[] = "Return an array containing multivariate normally distributed random numbers\n        with specified mean and covariance.\n\n        multivariate_normal(mean, cov) -> random values\n        multivariate_normal(mean, cov, [m, n, ...]) -> random values\n\n        mean must be a 1 dimensional array. cov must be a square two dimensional\n        array with the same number of rows and columns as mean has elements.\n\n        The first form returns a single 1-D array containing a multivariate\n        normal.\n\n        The second form returns an array of shape (m, n, ..., cov.shape[0]).\n        In this case, output[i,j,...,:] is a 1-D array containing a multivariate\n        normal.\n        ";
@@ -6539,40 +8376,40 @@
   __pyx_v_s = Py_None; Py_INCREF(Py_None);
   __pyx_v_v = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1113 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1448 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_array); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; goto __pyx_L1;}
   Py_INCREF(__pyx_v_mean);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mean);
-  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1448; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_mean);
   __pyx_v_mean = __pyx_3;
   __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1114 */
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1449 */
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; goto __pyx_L1;}
   Py_INCREF(__pyx_v_cov);
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cov);
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1449; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_v_cov);
   __pyx_v_cov = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1115 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1450 */
   __pyx_4 = __pyx_v_size == Py_None;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1116 */
-    __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1451 */
+    __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1451; goto __pyx_L1;}
     Py_DECREF(__pyx_v_shape);
     __pyx_v_shape = __pyx_1;
     __pyx_1 = 0;
@@ -6580,140 +8417,140 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1118 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1453 */
     Py_INCREF(__pyx_v_size);
     Py_DECREF(__pyx_v_shape);
     __pyx_v_shape = __pyx_v_size;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1119 */
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1454 */
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; goto __pyx_L1;}
+  __pyx_3 = PyInt_FromLong(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1454; goto __pyx_L1;}
   __pyx_4 = __pyx_4 != 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1120 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; goto __pyx_L1;}
-    Py_INCREF(__pyx_k119p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k119p);
-    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1455 */
+    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; goto __pyx_L1;}
+    Py_INCREF(__pyx_k165p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k165p);
+    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_3, 0, 0);
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1120; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1455; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1121 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1456 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
   __pyx_2 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
   __pyx_4 = __pyx_4 != 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (!__pyx_4) {
-    __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-    __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
-    __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
+    __pyx_5 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_1, __pyx_5, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1456; goto __pyx_L1;}
     __pyx_4 = __pyx_4 != 0;
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_5); __pyx_5 = 0;
   }
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1122 */
-    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
-    Py_INCREF(__pyx_k120p);
-    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k120p);
-    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1457 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; goto __pyx_L1;}
+    Py_INCREF(__pyx_k166p);
+    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k166p);
+    __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1457; goto __pyx_L1;}
     goto __pyx_L4;
   }
   __pyx_L4:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1123 */
-  __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
-  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1458 */
+  __pyx_5 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
+  __pyx_3 = PyInt_FromLong(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetItem(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
-  __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_cov, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
+  __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetItem(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1123; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1458; goto __pyx_L1;}
   __pyx_4 = __pyx_4 != 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1124 */
-    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
-    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
-    Py_INCREF(__pyx_k121p);
-    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k121p);
-    __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1459 */
+    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; goto __pyx_L1;}
+    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; goto __pyx_L1;}
+    Py_INCREF(__pyx_k167p);
+    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_k167p);
+    __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_5); __pyx_5 = 0;
     __Pyx_Raise(__pyx_2, 0, 0);
     Py_DECREF(__pyx_2); __pyx_2 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1124; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1459; goto __pyx_L1;}
     goto __pyx_L5;
   }
   __pyx_L5:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1126 */
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
-  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1461 */
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
   Py_INCREF(__pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_5, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1126; goto __pyx_L1;}
+  __pyx_4 = PyObject_IsTrue(__pyx_2); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1461; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_4) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1127 */
-    __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1127; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1462 */
+    __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1462; goto __pyx_L1;}
     Py_INCREF(__pyx_v_shape);
     PyList_SET_ITEM(__pyx_1, 0, __pyx_v_shape);
     Py_DECREF(__pyx_v_shape);
@@ -6723,186 +8560,186 @@
   }
   __pyx_L6:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1128 */
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; goto __pyx_L1;}
-  __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1463 */
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_list); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; goto __pyx_L1;}
+  __pyx_5 = PySequence_GetSlice(__pyx_v_shape, 0, 0x7fffffff); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
   __pyx_5 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1463; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_v_final_shape);
   __pyx_v_final_shape = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1129 */
-  __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
-  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1464 */
+  __pyx_5 = PyObject_GetAttr(__pyx_v_final_shape, __pyx_n_append); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetItem(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
   __pyx_1 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1464; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1133 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
-  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1468 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_standard_normal); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_n_multiply); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   Py_INCREF(__pyx_v_final_shape);
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_final_shape);
-  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
   __pyx_3 = 0;
-  __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; goto __pyx_L1;}
+  __pyx_5 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1468; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_v_x);
   __pyx_v_x = __pyx_5;
   __pyx_5 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1134 */
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1469 */
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_multiply); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_reduce); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
-  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_INCREF(__pyx_v_final_shape);
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_final_shape);
-  __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(__pyx_5, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
-  __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
+  __pyx_3 = PyNumber_Subtract(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
-  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_1 = PySequence_GetSlice(__pyx_v_final_shape, 0, __pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);
   __pyx_1 = 0;
-  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; goto __pyx_L1;}
-  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; goto __pyx_L1;}
-  __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_mean, __pyx_n_shape); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; goto __pyx_L1;}
+  __pyx_5 = PyObject_GetItem(__pyx_1, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1470; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
   PyTuple_SET_ITEM(__pyx_1, 1, __pyx_5);
   __pyx_3 = 0;
   __pyx_5 = 0;
-  if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1134; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1469; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1143 */
-  __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1478 */
+  __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; goto __pyx_L1;}
   Py_INCREF(__pyx_n_svd);
   PyList_SET_ITEM(__pyx_2, 0, __pyx_n_svd);
-  __pyx_3 = __Pyx_Import(__pyx_k122p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; goto __pyx_L1;}
+  __pyx_3 = __Pyx_Import(__pyx_k168p, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_svd); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; goto __pyx_L1;}
+  __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_svd); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1478; goto __pyx_L1;}
   Py_DECREF(__pyx_v_svd);
   __pyx_v_svd = __pyx_5;
   __pyx_5 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1145 */
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1480 */
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_INCREF(__pyx_v_cov);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_cov);
-  __pyx_2 = PyObject_CallObject(__pyx_v_svd, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_v_svd, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_5 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  __pyx_5 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_v_u);
   __pyx_v_u = __pyx_5;
   __pyx_5 = 0;
-  __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  __pyx_1 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_v_s);
   __pyx_v_s = __pyx_1;
   __pyx_1 = 0;
-  __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  __pyx_2 = __Pyx_UnpackItem(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_v_v);
   __pyx_v_v = __pyx_2;
   __pyx_2 = 0;
-  if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1145; goto __pyx_L1;}
+  if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1480; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1146 */
-  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_5, __pyx_n_dot); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1481 */
+  __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_5, __pyx_n_dot); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_sqrt); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_n_sqrt); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_INCREF(__pyx_v_s);
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_s);
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
-  __pyx_3 = PyNumber_Multiply(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_3 = PyNumber_Multiply(__pyx_v_x, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
   Py_INCREF(__pyx_v_v);
   PyTuple_SET_ITEM(__pyx_5, 1, __pyx_v_v);
   __pyx_3 = 0;
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1146; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1481; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_v_x);
   __pyx_v_x = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1149 */
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1484 */
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_add); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_5 = PyTuple_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+  __pyx_5 = PyTuple_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; goto __pyx_L1;}
   Py_INCREF(__pyx_v_mean);
   PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_mean);
   Py_INCREF(__pyx_v_x);
   PyTuple_SET_ITEM(__pyx_5, 1, __pyx_v_x);
   Py_INCREF(__pyx_v_x);
   PyTuple_SET_ITEM(__pyx_5, 2, __pyx_v_x);
-  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1149; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1484; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_5); __pyx_5 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1150 */
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1485 */
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_tuple); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; goto __pyx_L1;}
   Py_INCREF(__pyx_v_final_shape);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_final_shape);
-  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+  __pyx_5 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1150; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_v_x, __pyx_n_shape, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1485; goto __pyx_L1;}
   Py_DECREF(__pyx_5); __pyx_5 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1151 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1486 */
   Py_INCREF(__pyx_v_x);
   __pyx_r = __pyx_v_x;
   goto __pyx_L0;
@@ -6933,9 +8770,9 @@
 
 static PyObject *__pyx_n_zeros;
 
-static PyObject *__pyx_k124p;
+static PyObject *__pyx_k170p;
 
-static char (__pyx_k124[]) = "sum(pvals) > 1.0";
+static char (__pyx_k170[]) = "sum(pvals) > 1.0";
 
 static PyObject *__pyx_f_6mtrand_11RandomState_multinomial(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
 static char __pyx_doc_6mtrand_11RandomState_multinomial[] = "Multinomial distribution.\n        \n        multinomial(n, pvals, size=None) -> random values\n\n        pvals is a sequence of probabilities that should sum to 1 (however, the\n        last element is always assumed to account for the remaining probability\n        as long as sum(pvals[:-1]) <= 1).\n        ";
@@ -6971,54 +8808,54 @@
   __pyx_v_shape = Py_None; Py_INCREF(Py_None);
   __pyx_v_multin = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1169 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1504 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; goto __pyx_L1;}
   Py_INCREF(__pyx_v_pvals);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_pvals);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1169; goto __pyx_L1;}
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1504; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   __pyx_v_d = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1170 */
-  __pyx_1 = PyArray_ContiguousFromObject(__pyx_v_pvals,NPY_DOUBLE,1,1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1170; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1505 */
+  __pyx_1 = PyArray_ContiguousFromObject(__pyx_v_pvals,NPY_DOUBLE,1,1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1505; goto __pyx_L1;}
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
   Py_DECREF(((PyObject *)arrayObject_parr));
   arrayObject_parr = ((PyArrayObject *)__pyx_1);
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1171 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1506 */
   __pyx_v_pix = ((double (*))arrayObject_parr->data);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1173 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1508 */
   __pyx_5 = (__pyx_f_6mtrand_kahan_sum(__pyx_v_pix,(__pyx_v_d - 1)) > 1.0);
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1174 */
-    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; goto __pyx_L1;}
-    Py_INCREF(__pyx_k124p);
-    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k124p);
-    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1509 */
+    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
+    Py_INCREF(__pyx_k170p);
+    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k170p);
+    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     __Pyx_Raise(__pyx_1, 0, 0);
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1174; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1509; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1176 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1511 */
   __pyx_5 = __pyx_v_size == Py_None;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1177 */
-    __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1177; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1512 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1512; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
     __pyx_2 = 0;
     Py_DECREF(__pyx_v_shape);
@@ -7026,22 +8863,22 @@
     __pyx_3 = 0;
     goto __pyx_L3;
   }
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; goto __pyx_L1;}
   Py_INCREF(__pyx_v_size);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1178; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1513; goto __pyx_L1;}
   __pyx_5 = __pyx_3 == __pyx_1;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1179 */
-    __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1179; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1514 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_d); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1514; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
@@ -7053,12 +8890,12 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1181 */
-    __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1516 */
+    __pyx_1 = PyInt_FromLong(__pyx_v_d); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
     __pyx_1 = 0;
-    __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1181; goto __pyx_L1;}
+    __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1516; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_v_shape);
     __pyx_v_shape = __pyx_3;
@@ -7066,85 +8903,85 @@
   }
   __pyx_L3:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1183 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1518 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
   Py_INCREF(__pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_1, 1, __pyx_3);
   __pyx_3 = 0;
-  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1183; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1518; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_multin);
   __pyx_v_multin = __pyx_3;
   __pyx_3 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1184 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1519 */
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_multin)));
   Py_DECREF(((PyObject *)arrayObject_mnarr));
   arrayObject_mnarr = ((PyArrayObject *)__pyx_v_multin);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1185 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1520 */
   __pyx_v_mnix = ((long (*))arrayObject_mnarr->data);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1186 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1521 */
   __pyx_v_i = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1187 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1522 */
   while (1) {
     __pyx_5 = (__pyx_v_i < PyArray_SIZE(arrayObject_mnarr));
     if (!__pyx_5) break;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1188 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1523 */
     __pyx_v_Sum = 1.0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1189 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1524 */
     __pyx_v_dn = __pyx_v_n;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1190 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1525 */
     __pyx_4 = (__pyx_v_d - 1);
     for (__pyx_v_j = 0; __pyx_v_j < __pyx_4; ++__pyx_v_j) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1191 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1526 */
       (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]) = rk_binomial(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,__pyx_v_dn,((__pyx_v_pix[__pyx_v_j]) / __pyx_v_Sum));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1192 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1527 */
       __pyx_v_dn = (__pyx_v_dn - (__pyx_v_mnix[(__pyx_v_i + __pyx_v_j)]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1193 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1528 */
       __pyx_5 = (__pyx_v_dn <= 0);
       if (__pyx_5) {
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1194 */
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1529 */
         goto __pyx_L7;
         goto __pyx_L8;
       }
       __pyx_L8:;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1195 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1530 */
       __pyx_v_Sum = (__pyx_v_Sum - (__pyx_v_pix[__pyx_v_j]));
     }
     __pyx_L7:;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1196 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1531 */
     __pyx_5 = (__pyx_v_dn > 0);
     if (__pyx_5) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1197 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1532 */
       (__pyx_v_mnix[((__pyx_v_i + __pyx_v_d) - 1)]) = __pyx_v_dn;
       goto __pyx_L9;
     }
     __pyx_L9:;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1199 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1534 */
     __pyx_v_i = (__pyx_v_i + __pyx_v_d);
   }
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1201 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1536 */
   Py_INCREF(__pyx_v_multin);
   __pyx_r = __pyx_v_multin;
   goto __pyx_L0;
@@ -7202,35 +9039,35 @@
   __pyx_v_shape = Py_None; Py_INCREF(Py_None);
   __pyx_v_diric = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1258 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1593 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; goto __pyx_L1;}
   Py_INCREF(__pyx_v_alpha);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_alpha);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1258; goto __pyx_L1;}
+  __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1593; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   __pyx_v_k = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1259 */
-  __pyx_1 = PyArray_ContiguousFromObject(__pyx_v_alpha,NPY_DOUBLE,1,1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1259; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1594 */
+  __pyx_1 = PyArray_ContiguousFromObject(__pyx_v_alpha,NPY_DOUBLE,1,1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1594; goto __pyx_L1;}
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
   Py_DECREF(((PyObject *)__pyx_v_alpha_arr));
   __pyx_v_alpha_arr = ((PyArrayObject *)__pyx_1);
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1260 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1595 */
   __pyx_v_alpha_data = ((double (*))__pyx_v_alpha_arr->data);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1262 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1597 */
   __pyx_5 = __pyx_v_size == Py_None;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1263 */
-    __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1263; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1598 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1598; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
     __pyx_2 = 0;
     Py_DECREF(__pyx_v_shape);
@@ -7238,22 +9075,22 @@
     __pyx_3 = 0;
     goto __pyx_L2;
   }
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_type); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; goto __pyx_L1;}
   Py_INCREF(__pyx_v_size);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_size);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1264; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1599; goto __pyx_L1;}
   __pyx_5 = __pyx_3 == __pyx_1;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1265 */
-    __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1265; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1600 */
+    __pyx_2 = PyInt_FromLong(__pyx_v_k); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1600; goto __pyx_L1;}
     Py_INCREF(__pyx_v_size);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_size);
     PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
@@ -7265,12 +9102,12 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1267 */
-    __pyx_1 = PyInt_FromLong(__pyx_v_k); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1602 */
+    __pyx_1 = PyInt_FromLong(__pyx_v_k); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
     __pyx_1 = 0;
-    __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1267; goto __pyx_L1;}
+    __pyx_3 = PyNumber_Add(__pyx_v_size, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1602; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_v_shape);
     __pyx_v_shape = __pyx_3;
@@ -7278,72 +9115,72 @@
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1269 */
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1604 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_zeros); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
-  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_float64); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_float64); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
   Py_INCREF(__pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_shape);
   PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);
   __pyx_1 = 0;
-  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1269; goto __pyx_L1;}
+  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1604; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_v_diric);
   __pyx_v_diric = __pyx_1;
   __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1270 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1605 */
   Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_diric)));
   Py_DECREF(((PyObject *)__pyx_v_val_arr));
   __pyx_v_val_arr = ((PyArrayObject *)__pyx_v_diric);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1271 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1606 */
   __pyx_v_val_data = ((double (*))__pyx_v_val_arr->data);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1273 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1608 */
   __pyx_v_i = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1274 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1609 */
   __pyx_v_totsize = PyArray_SIZE(__pyx_v_val_arr);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1275 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1610 */
   while (1) {
     __pyx_5 = (__pyx_v_i < __pyx_v_totsize);
     if (!__pyx_5) break;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1276 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1611 */
     __pyx_v_acc = 0.0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1277 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1612 */
     for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_k; ++__pyx_v_j) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1278 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1613 */
       (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = rk_standard_gamma(((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state,(__pyx_v_alpha_data[__pyx_v_j]));
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1279 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1614 */
       __pyx_v_acc = (__pyx_v_acc + (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]));
     }
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1280 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1615 */
     __pyx_v_invacc = (1 / __pyx_v_acc);
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1281 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1616 */
     for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_k; ++__pyx_v_j) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1282 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1617 */
       (__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) = ((__pyx_v_val_data[(__pyx_v_i + __pyx_v_j)]) * __pyx_v_invacc);
     }
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1283 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1618 */
     __pyx_v_i = (__pyx_v_i + __pyx_v_k);
   }
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1285 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1620 */
   Py_INCREF(__pyx_v_diric);
   __pyx_r = __pyx_v_diric;
   goto __pyx_L0;
@@ -7389,37 +9226,37 @@
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_x);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1296 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1631 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
   Py_INCREF(__pyx_v_x);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
-  __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
+  __pyx_2 = PyNumber_Subtract(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1296; goto __pyx_L1;}
+  __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1631; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __pyx_v_i = __pyx_4;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1297 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1632 */
   /*try:*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1298 */
-    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
-    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
-    __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1633 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
+    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
+    __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
+    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
     PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
+    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1298; goto __pyx_L2;}
+    __pyx_4 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1633; goto __pyx_L2;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __pyx_v_j = __pyx_4;
   }
@@ -7429,142 +9266,142 @@
   Py_XDECREF(__pyx_1); __pyx_1 = 0;
   Py_XDECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1299 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1634 */
   /*except:*/ {
     __Pyx_AddTraceback("mtrand.shuffle");
-    __pyx_3 = __Pyx_GetExcValue(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1299; goto __pyx_L1;}
+    __pyx_3 = __Pyx_GetExcValue(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1634; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1300 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1635 */
     __pyx_v_j = 0;
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1302 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1637 */
   __pyx_5 = (__pyx_v_j == 0);
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1304 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1639 */
     while (1) {
       __pyx_5 = (__pyx_v_i > 0);
       if (!__pyx_5) break;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1305 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1640 */
       __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1306 */
-      __pyx_1 = PyInt_FromLong(__pyx_v_j); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
-      __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1641 */
+      __pyx_1 = PyInt_FromLong(__pyx_v_j); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
+      __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
       Py_DECREF(__pyx_1); __pyx_1 = 0;
-      __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
-      __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
+      __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
+      __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
       Py_DECREF(__pyx_3); __pyx_3 = 0;
-      __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
-      if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
+      __pyx_3 = PyInt_FromLong(__pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
+      if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
       Py_DECREF(__pyx_3); __pyx_3 = 0;
       Py_DECREF(__pyx_2); __pyx_2 = 0;
-      __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
-      if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1306; goto __pyx_L1;}
+      __pyx_2 = PyInt_FromLong(__pyx_v_j); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
+      if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1641; goto __pyx_L1;}
       Py_DECREF(__pyx_2); __pyx_2 = 0;
       Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1307 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1642 */
       __pyx_v_i = (__pyx_v_i - 1);
     }
     goto __pyx_L4;
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1310 */
-    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_hasattr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
-    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
-    __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1645 */
+    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_hasattr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
+    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
+    __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
     Py_INCREF(__pyx_n_copy);
     PyTuple_SET_ITEM(__pyx_1, 1, __pyx_n_copy);
     __pyx_2 = 0;
-    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
+    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_1); __pyx_1 = 0;
-    __pyx_5 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1310; goto __pyx_L1;}
+    __pyx_5 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1645; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     __pyx_v_copy = __pyx_5;
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1311 */
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1646 */
     __pyx_5 = __pyx_v_copy;
     if (__pyx_5) {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1312 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1647 */
       while (1) {
         __pyx_5 = (__pyx_v_i > 0);
         if (!__pyx_5) break;
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1313 */
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1648 */
         __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1314 */
-        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
-        __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1649 */
+        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
+        __pyx_1 = PyObject_GetItem(__pyx_v_x, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_3); __pyx_3 = 0;
-        __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_copy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_copy); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
-        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
+        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_copy); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
-        if (PyObject_SetItem(__pyx_v_x, __pyx_1, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
+        if (PyObject_SetItem(__pyx_v_x, __pyx_1, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
         Py_DECREF(__pyx_3); __pyx_3 = 0;
-        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
-        if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1314; goto __pyx_L1;}
+        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
+        if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1649; goto __pyx_L1;}
         Py_DECREF(__pyx_3); __pyx_3 = 0;
         Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1315 */
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1650 */
         __pyx_v_i = (__pyx_v_i - 1);
       }
       goto __pyx_L7;
     }
     /*else*/ {
 
-      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1317 */
+      /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1652 */
       while (1) {
         __pyx_5 = (__pyx_v_i > 0);
         if (!__pyx_5) break;
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1318 */
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1653 */
         __pyx_v_j = rk_interval(__pyx_v_i,((struct __pyx_obj_6mtrand_RandomState *)__pyx_v_self)->internal_state);
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1319 */
-        __pyx_1 = PyInt_FromLong(__pyx_v_j); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
-        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1654 */
+        __pyx_1 = PyInt_FromLong(__pyx_v_j); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
+        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_3 = PySequence_GetSlice(__pyx_2, 0, 0x7fffffff); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        __pyx_3 = PySequence_GetSlice(__pyx_2, 0, 0x7fffffff); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
-        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
+        __pyx_2 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_1); __pyx_1 = 0;
-        __pyx_1 = PySequence_GetSlice(__pyx_2, 0, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        __pyx_1 = PySequence_GetSlice(__pyx_2, 0, 0x7fffffff); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
-        __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
-        if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
+        if (PyObject_SetItem(__pyx_v_x, __pyx_2, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_2); __pyx_2 = 0;
         Py_DECREF(__pyx_3); __pyx_3 = 0;
-        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
-        if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1319; goto __pyx_L1;}
+        __pyx_3 = PyInt_FromLong(__pyx_v_j); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
+        if (PyObject_SetItem(__pyx_v_x, __pyx_3, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1654; goto __pyx_L1;}
         Py_DECREF(__pyx_3); __pyx_3 = 0;
         Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1320 */
+        /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1655 */
         __pyx_v_i = (__pyx_v_i - 1);
       }
     }
@@ -7606,37 +9443,37 @@
   Py_INCREF(__pyx_v_x);
   __pyx_v_arr = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1328 */
-  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
-  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
-  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_integer); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1663 */
+  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_isinstance); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
+  __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_integer); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
   PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
   PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
   __pyx_2 = 0;
   __pyx_4 = 0;
-  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
   Py_INCREF(__pyx_v_x);
   PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
   PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3);
   __pyx_3 = 0;
-  __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1328; goto __pyx_L1;}
+  __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1663; goto __pyx_L1;}
   Py_DECREF(__pyx_4); __pyx_4 = 0;
   if (__pyx_5) {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1329 */
-    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
-    __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_arange); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1664 */
+    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_arange); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; goto __pyx_L1;}
     Py_INCREF(__pyx_v_x);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
-    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1329; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1664; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_v_arr);
@@ -7646,14 +9483,14 @@
   }
   /*else*/ {
 
-    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1331 */
-    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;}
-    __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;}
+    /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1666 */
+    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n__sp); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_n_array); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; goto __pyx_L1;}
     Py_DECREF(__pyx_3); __pyx_3 = 0;
-    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;}
+    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; goto __pyx_L1;}
     Py_INCREF(__pyx_v_x);
     PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x);
-    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1331; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1666; goto __pyx_L1;}
     Py_DECREF(__pyx_1); __pyx_1 = 0;
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_v_arr);
@@ -7662,17 +9499,17 @@
   }
   __pyx_L2:;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1332 */
-  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; goto __pyx_L1;}
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1667 */
+  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_shuffle); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; goto __pyx_L1;}
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; goto __pyx_L1;}
   Py_INCREF(__pyx_v_arr);
   PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_arr);
-  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1332; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1667; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1333 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1668 */
   Py_INCREF(__pyx_v_arr);
   __pyx_r = __pyx_v_arr;
   goto __pyx_L0;
@@ -7694,7 +9531,10 @@
 }
 
 static __Pyx_InternTabEntry __pyx_intern_tab[] = {
+  {&__pyx_n_Float64, "Float64"},
+  {&__pyx_n_Int, "Int"},
   {&__pyx_n_MT19937, "MT19937"},
+  {&__pyx_n_PyInt_AsLong, "PyInt_AsLong"},
   {&__pyx_n_ValueError, "ValueError"},
   {&__pyx_n___RandomState_ctor, "__RandomState_ctor"},
   {&__pyx_n__rand, "_rand"},
@@ -7716,6 +9556,7 @@
   {&__pyx_n_exponential, "exponential"},
   {&__pyx_n_f, "f"},
   {&__pyx_n_float64, "float64"},
+  {&__pyx_n_fscale, "fscale"},
   {&__pyx_n_gamma, "gamma"},
   {&__pyx_n_geometric, "geometric"},
   {&__pyx_n_get_state, "get_state"},
@@ -7839,7 +9680,53 @@
   {&__pyx_k120p, __pyx_k120, sizeof(__pyx_k120)},
   {&__pyx_k121p, __pyx_k121, sizeof(__pyx_k121)},
   {&__pyx_k122p, __pyx_k122, sizeof(__pyx_k122)},
+  {&__pyx_k123p, __pyx_k123, sizeof(__pyx_k123)},
   {&__pyx_k124p, __pyx_k124, sizeof(__pyx_k124)},
+  {&__pyx_k125p, __pyx_k125, sizeof(__pyx_k125)},
+  {&__pyx_k126p, __pyx_k126, sizeof(__pyx_k126)},
+  {&__pyx_k127p, __pyx_k127, sizeof(__pyx_k127)},
+  {&__pyx_k128p, __pyx_k128, sizeof(__pyx_k128)},
+  {&__pyx_k129p, __pyx_k129, sizeof(__pyx_k129)},
+  {&__pyx_k130p, __pyx_k130, sizeof(__pyx_k130)},
+  {&__pyx_k131p, __pyx_k131, sizeof(__pyx_k131)},
+  {&__pyx_k132p, __pyx_k132, sizeof(__pyx_k132)},
+  {&__pyx_k133p, __pyx_k133, sizeof(__pyx_k133)},
+  {&__pyx_k134p, __pyx_k134, sizeof(__pyx_k134)},
+  {&__pyx_k135p, __pyx_k135, sizeof(__pyx_k135)},
+  {&__pyx_k136p, __pyx_k136, sizeof(__pyx_k136)},
+  {&__pyx_k137p, __pyx_k137, sizeof(__pyx_k137)},
+  {&__pyx_k138p, __pyx_k138, sizeof(__pyx_k138)},
+  {&__pyx_k139p, __pyx_k139, sizeof(__pyx_k139)},
+  {&__pyx_k140p, __pyx_k140, sizeof(__pyx_k140)},
+  {&__pyx_k141p, __pyx_k141, sizeof(__pyx_k141)},
+  {&__pyx_k142p, __pyx_k142, sizeof(__pyx_k142)},
+  {&__pyx_k143p, __pyx_k143, sizeof(__pyx_k143)},
+  {&__pyx_k144p, __pyx_k144, sizeof(__pyx_k144)},
+  {&__pyx_k145p, __pyx_k145, sizeof(__pyx_k145)},
+  {&__pyx_k146p, __pyx_k146, sizeof(__pyx_k146)},
+  {&__pyx_k147p, __pyx_k147, sizeof(__pyx_k147)},
+  {&__pyx_k148p, __pyx_k148, sizeof(__pyx_k148)},
+  {&__pyx_k149p, __pyx_k149, sizeof(__pyx_k149)},
+  {&__pyx_k150p, __pyx_k150, sizeof(__pyx_k150)},
+  {&__pyx_k151p, __pyx_k151, sizeof(__pyx_k151)},
+  {&__pyx_k152p, __pyx_k152, sizeof(__pyx_k152)},
+  {&__pyx_k153p, __pyx_k153, sizeof(__pyx_k153)},
+  {&__pyx_k154p, __pyx_k154, sizeof(__pyx_k154)},
+  {&__pyx_k155p, __pyx_k155, sizeof(__pyx_k155)},
+  {&__pyx_k156p, __pyx_k156, sizeof(__pyx_k156)},
+  {&__pyx_k157p, __pyx_k157, sizeof(__pyx_k157)},
+  {&__pyx_k158p, __pyx_k158, sizeof(__pyx_k158)},
+  {&__pyx_k159p, __pyx_k159, sizeof(__pyx_k159)},
+  {&__pyx_k160p, __pyx_k160, sizeof(__pyx_k160)},
+  {&__pyx_k161p, __pyx_k161, sizeof(__pyx_k161)},
+  {&__pyx_k162p, __pyx_k162, sizeof(__pyx_k162)},
+  {&__pyx_k163p, __pyx_k163, sizeof(__pyx_k163)},
+  {&__pyx_k164p, __pyx_k164, sizeof(__pyx_k164)},
+  {&__pyx_k165p, __pyx_k165, sizeof(__pyx_k165)},
+  {&__pyx_k166p, __pyx_k166, sizeof(__pyx_k166)},
+  {&__pyx_k167p, __pyx_k167, sizeof(__pyx_k167)},
+  {&__pyx_k168p, __pyx_k168, sizeof(__pyx_k168)},
+  {&__pyx_k170p, __pyx_k170, sizeof(__pyx_k170)},
   {0, 0, 0}
 };
 
@@ -8077,8 +9964,8 @@
   __pyx_ptype_6mtrand_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (!__pyx_ptype_6mtrand_ndarray) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 79; goto __pyx_L1;}
   __pyx_ptype_6mtrand_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (!__pyx_ptype_6mtrand_flatiter) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; goto __pyx_L1;}
   __pyx_ptype_6mtrand_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (!__pyx_ptype_6mtrand_broadcast) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; goto __pyx_L1;}
-  if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;}
-  if (PyObject_SetAttrString(__pyx_m, "RandomState", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; goto __pyx_L1;}
+  if (PyType_Ready(&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}
+  if (PyObject_SetAttrString(__pyx_m, "RandomState", (PyObject *)&__pyx_type_6mtrand_RandomState) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 468; goto __pyx_L1;}
   __pyx_ptype_6mtrand_RandomState = &__pyx_type_6mtrand_RandomState;
 
   /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":119 */
@@ -8089,547 +9976,547 @@
   if (PyObject_SetAttr(__pyx_m, __pyx_n__sp, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":476 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":488 */
   Py_INCREF(Py_None);
   __pyx_k2 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":486 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":498 */
   Py_INCREF(Py_None);
   __pyx_k3 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":547 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":559 */
   Py_INCREF(Py_None);
   __pyx_k4 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":554 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":566 */
   Py_INCREF(Py_None);
   __pyx_k5 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":561 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":573 */
   Py_INCREF(Py_None);
   __pyx_k6 = Py_None;
   Py_INCREF(Py_None);
   __pyx_k7 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":607 */
-  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":618 */
+  __pyx_1 = PyFloat_FromDouble(0.0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
   __pyx_k8 = __pyx_1;
   __pyx_1 = 0;
-  __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; goto __pyx_L1;}
+  __pyx_2 = PyFloat_FromDouble(1.0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; goto __pyx_L1;}
   __pyx_k9 = __pyx_2;
   __pyx_2 = 0;
   Py_INCREF(Py_None);
   __pyx_k10 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":655 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":671 */
   Py_INCREF(Py_None);
   __pyx_k11 = Py_None;
   Py_INCREF(Py_None);
   __pyx_k12 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":668 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":684 */
   Py_INCREF(Py_None);
   __pyx_k13 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":675 */
-  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":691 */
+  __pyx_3 = PyFloat_FromDouble(0.0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;}
   __pyx_k14 = __pyx_3;
   __pyx_3 = 0;
-  __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; goto __pyx_L1;}
+  __pyx_4 = PyFloat_FromDouble(1.0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 691; goto __pyx_L1;}
   __pyx_k15 = __pyx_4;
   __pyx_4 = 0;
   Py_INCREF(Py_None);
   __pyx_k16 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":688 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":714 */
   Py_INCREF(Py_None);
   __pyx_k17 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":704 */
-  __pyx_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":741 */
+  __pyx_5 = PyFloat_FromDouble(1.0); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; goto __pyx_L1;}
   __pyx_k18 = __pyx_5;
   __pyx_5 = 0;
   Py_INCREF(Py_None);
   __pyx_k19 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":715 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":762 */
   Py_INCREF(Py_None);
   __pyx_k20 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":722 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":769 */
   Py_INCREF(Py_None);
   __pyx_k21 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":733 */
-  __pyx_6 = PyFloat_FromDouble(1.0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":789 */
+  __pyx_6 = PyFloat_FromDouble(1.0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; goto __pyx_L1;}
   __pyx_k22 = __pyx_6;
   __pyx_6 = 0;
   Py_INCREF(Py_None);
   __pyx_k23 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":748 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":815 */
   Py_INCREF(Py_None);
   __pyx_k24 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":763 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":842 */
   Py_INCREF(Py_None);
   __pyx_k25 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":784 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":878 */
   Py_INCREF(Py_None);
   __pyx_k26 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":795 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":899 */
   Py_INCREF(Py_None);
   __pyx_k27 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":811 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":927 */
   Py_INCREF(Py_None);
   __pyx_k28 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":818 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":934 */
   Py_INCREF(Py_None);
   __pyx_k29 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":829 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":955 */
   Py_INCREF(Py_None);
   __pyx_k30 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":843 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":979 */
   Py_INCREF(Py_None);
   __pyx_k31 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":854 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1000 */
   Py_INCREF(Py_None);
   __pyx_k32 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":865 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1021 */
   Py_INCREF(Py_None);
   __pyx_k33 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":876 */
-  __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1042 */
+  __pyx_7 = PyFloat_FromDouble(0.0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; goto __pyx_L1;}
   __pyx_k34 = __pyx_7;
   __pyx_7 = 0;
-  __pyx_8 = PyFloat_FromDouble(1.0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 876; goto __pyx_L1;}
+  __pyx_8 = PyFloat_FromDouble(1.0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1042; goto __pyx_L1;}
   __pyx_k35 = __pyx_8;
   __pyx_8 = 0;
   Py_INCREF(Py_None);
   __pyx_k36 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":889 */
-  __pyx_9 = PyFloat_FromDouble(0.0); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1064 */
+  __pyx_9 = PyFloat_FromDouble(0.0); if (!__pyx_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; goto __pyx_L1;}
   __pyx_k37 = __pyx_9;
   __pyx_9 = 0;
-  __pyx_10 = PyFloat_FromDouble(1.0); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; goto __pyx_L1;}
+  __pyx_10 = PyFloat_FromDouble(1.0); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1064; goto __pyx_L1;}
   __pyx_k38 = __pyx_10;
   __pyx_10 = 0;
   Py_INCREF(Py_None);
   __pyx_k39 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":902 */
-  __pyx_11 = PyFloat_FromDouble(0.0); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1086 */
+  __pyx_11 = PyFloat_FromDouble(0.0); if (!__pyx_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; goto __pyx_L1;}
   __pyx_k40 = __pyx_11;
   __pyx_11 = 0;
-  __pyx_12 = PyFloat_FromDouble(1.0); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; goto __pyx_L1;}
+  __pyx_12 = PyFloat_FromDouble(1.0); if (!__pyx_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; goto __pyx_L1;}
   __pyx_k41 = __pyx_12;
   __pyx_12 = 0;
   Py_INCREF(Py_None);
   __pyx_k42 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":915 */
-  __pyx_13 = PyFloat_FromDouble(0.0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1108 */
+  __pyx_13 = PyFloat_FromDouble(0.0); if (!__pyx_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; goto __pyx_L1;}
   __pyx_k43 = __pyx_13;
   __pyx_13 = 0;
-  __pyx_14 = PyFloat_FromDouble(1.0); if (!__pyx_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 915; goto __pyx_L1;}
+  __pyx_14 = PyFloat_FromDouble(1.0); if (!__pyx_14) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; goto __pyx_L1;}
   __pyx_k44 = __pyx_14;
   __pyx_14 = 0;
   Py_INCREF(Py_None);
   __pyx_k45 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":933 */
-  __pyx_15 = PyFloat_FromDouble(1.0); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1137 */
+  __pyx_15 = PyFloat_FromDouble(1.0); if (!__pyx_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; goto __pyx_L1;}
   __pyx_k46 = __pyx_15;
   __pyx_15 = 0;
   Py_INCREF(Py_None);
   __pyx_k47 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":944 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1159 */
   Py_INCREF(Py_None);
   __pyx_k48 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":959 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1187 */
   Py_INCREF(Py_None);
   __pyx_k49 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":982 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1224 */
   Py_INCREF(Py_None);
   __pyx_k50 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":999 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1256 */
   Py_INCREF(Py_None);
   __pyx_k51 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1017 */
-  __pyx_16 = PyFloat_FromDouble(1.0); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1017; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1291 */
+  __pyx_16 = PyFloat_FromDouble(1.0); if (!__pyx_16) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1291; goto __pyx_L1;}
   __pyx_k52 = __pyx_16;
   __pyx_16 = 0;
   Py_INCREF(Py_None);
   __pyx_k53 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1028 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1311 */
   Py_INCREF(Py_None);
   __pyx_k54 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1039 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1332 */
   Py_INCREF(Py_None);
   __pyx_k55 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1053 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1359 */
   Py_INCREF(Py_None);
   __pyx_k56 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1081 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1404 */
   Py_INCREF(Py_None);
   __pyx_k57 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1095 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1430 */
   Py_INCREF(Py_None);
   __pyx_k58 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1153 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1488 */
   Py_INCREF(Py_None);
   __pyx_k59 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1203 */
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1538 */
   Py_INCREF(Py_None);
   __pyx_k60 = Py_None;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1335 */
-  __pyx_17 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), 0); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; goto __pyx_L1;}
-  if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1335; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1670 */
+  __pyx_17 = PyObject_CallObject(((PyObject*)__pyx_ptype_6mtrand_RandomState), 0); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n__rand, __pyx_17) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1670; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1336 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_seed); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1671 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_seed); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_seed, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1336; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_seed, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1671; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1337 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_get_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1672 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_get_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1337; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_get_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1672; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1338 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_set_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1673 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_set_state); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1338; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_set_state, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1673; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1339 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_sample); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1674 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_sample); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1339; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_random_sample, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1674; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1340 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randint); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1675 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randint); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1340; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_randint, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1675; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1341 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_bytes); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1676 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_bytes); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1341; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_bytes, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1676; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1342 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_uniform); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1677 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_uniform); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1342; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_uniform, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1677; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1343 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rand); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1678 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rand); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1343; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_rand, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1678; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1344 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randn); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1679 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_randn); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1344; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_randn, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1679; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1345 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_integers); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1680 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_random_integers); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1345; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_random_integers, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1680; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1346 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1681 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1346; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1681; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1347 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1682 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1347; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1682; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1348 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_beta); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1683 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_beta); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1348; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_beta, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1683; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1349 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1684 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1349; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1684; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1350 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1685 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_exponential); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1350; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_exponential, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1685; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1351 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1686 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1351; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1686; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1352 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1687 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gamma); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1352; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_gamma, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1687; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1353 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1688 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1353; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1688; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1354 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1689 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_f); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1354; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_f, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1689; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1355 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1690 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1355; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1690; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1356 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1691 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_noncentral_chisquare); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1356; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_noncentral_chisquare, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1691; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1357 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_cauchy); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1692 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_cauchy); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1357; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_cauchy, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1692; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1358 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_t); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1693 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_standard_t); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1358; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_standard_t, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1693; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1359 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_vonmises); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1694 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_vonmises); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1359; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_vonmises, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1694; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1360 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_pareto); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1695 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_pareto); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1360; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_pareto, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1695; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1361 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_weibull); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1696 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_weibull); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1361; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_weibull, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1696; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1362 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_power); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1697 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_power); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1362; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_power, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1697; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1363 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_laplace); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1698 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_laplace); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1363; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_laplace, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1698; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1364 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gumbel); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1699 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_gumbel); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1364; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_gumbel, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1699; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1365 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logistic); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1700 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logistic); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1365; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_logistic, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1700; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1366 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_lognormal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1701 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_lognormal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1366; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_lognormal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1701; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1367 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rayleigh); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1702 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_rayleigh); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1367; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_rayleigh, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1702; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1368 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_wald); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1703 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_wald); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1368; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_wald, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1703; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1369 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_triangular); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1704 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_triangular); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1369; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_triangular, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1704; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1371 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1706 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1371; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1706; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1372 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_negative_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1707 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_negative_binomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1372; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_negative_binomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1707; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1373 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_poisson); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1708 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_poisson); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1373; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_poisson, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1708; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1374 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_zipf); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1709 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_zipf); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1374; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_zipf, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1709; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1375 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_geometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1710 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_geometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1375; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_geometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1710; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1376 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_hypergeometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1711 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_hypergeometric); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1376; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_hypergeometric, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1711; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1377 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logseries); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1712 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_logseries); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1377; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_logseries, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1712; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1379 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multivariate_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1714 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multivariate_normal); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1379; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_multivariate_normal, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1714; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1380 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multinomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1715 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_multinomial); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1380; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_multinomial, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1715; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1381 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_dirichlet); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1716 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_dirichlet); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_dirichlet, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1381; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_dirichlet, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1716; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1383 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_shuffle); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1718 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_shuffle); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1383; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_shuffle, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1718; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
 
-  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1384 */
-  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
-  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_permutation); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+  /* "/home/oliphant/numpy/numpy/random/mtrand/mtrand.pyx":1719 */
+  __pyx_17 = __Pyx_GetName(__pyx_m, __pyx_n__rand); if (!__pyx_17) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;}
+  __pyx_18 = PyObject_GetAttr(__pyx_17, __pyx_n_permutation); if (!__pyx_18) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;}
   Py_DECREF(__pyx_17); __pyx_17 = 0;
-  if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1384; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_m, __pyx_n_permutation, __pyx_18) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1719; goto __pyx_L1;}
   Py_DECREF(__pyx_18); __pyx_18 = 0;
   return;
   __pyx_L1:;

Modified: trunk/numpy/random/mtrand/mtrand.pyx
===================================================================
--- trunk/numpy/random/mtrand/mtrand.pyx	2007-03-16 12:53:05 UTC (rev 3581)
+++ trunk/numpy/random/mtrand/mtrand.pyx	2007-03-19 17:19:39 UTC (rev 3582)
@@ -136,6 +136,23 @@
             array_data[i] = func(state)
         return array
 
+
+cdef object cont1_array_sc(rk_state *state, rk_cont1 func, object size, double a):
+    cdef double *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+    
+    if size is None:
+        return func(state, a)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.Float64)
+        length = PyArray_SIZE(array)
+        array_data = <double *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, a)
+        return array
+
 cdef object cont1_array(rk_state *state, rk_cont1 func, object size, ndarray oa):
     cdef double *array_data
     cdef double *oa_data
@@ -144,42 +161,46 @@
     cdef npy_intp i
     cdef flatiter itera
     cdef broadcast multi
-    cdef int scalar
 
-    scalar = 0
-    if oa.nd == 0:
-        oa_data = <double *>oa.data
-        scalar = 1
-
     if size is None:
-        if scalar:
-            return func(state, oa_data[0])
-        else:
-            array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE)
-            length = PyArray_SIZE(array)
-            array_data = <double *>array.data
-            itera = <flatiter>PyArray_IterNew(<object>oa)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, (<double *>(itera.dataptr))[0])
-                PyArray_ITER_NEXT(itera)
+        array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_DOUBLE)
+        length = PyArray_SIZE(array)
+        array_data = <double *>array.data
+        itera = <flatiter>PyArray_IterNew(<object>oa)
+        for i from 0 <= i < length:
+            array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+            PyArray_ITER_NEXT(itera)
     else:
         array = <ndarray>_sp.empty(size, _sp.float64)
         array_data = <double *>array.data
-        if scalar:
-            length = PyArray_SIZE(array)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, oa_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(2, <void *>array,
-                                                    <void *>oa)
-            if (multi.size != PyArray_SIZE(array)): 
-                raise ValueError("size is not compatible with inputs")
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                array_data[i] = func(state, oa_data[0])
-                PyArray_MultiIter_NEXTi(multi, 1)
+        multi = <broadcast>PyArray_MultiIterNew(2, <void *>array,
+                                                <void *>oa)
+        if (multi.size != PyArray_SIZE(array)): 
+            raise ValueError("size is not compatible with inputs")
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            array_data[i] = func(state, oa_data[0])
+            PyArray_MultiIter_NEXTi(multi, 1)
     return array
 
+cdef object cont2_array_sc(rk_state *state, rk_cont2 func, object size, double a,
+                           double b):
+    cdef double *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+
+    if size is None:
+        return func(state, a, b)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.float64)
+        length = PyArray_SIZE(array)
+        array_data = <double *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, a, b)
+        return array
+                               
+
 cdef object cont2_array(rk_state *state, rk_cont2 func, object size,
                         ndarray oa, ndarray ob):
     cdef double *array_data
@@ -189,45 +210,48 @@
     cdef npy_intp length
     cdef npy_intp i
     cdef broadcast multi
-    cdef int scalar
-
-    scalar = 0
-    if oa.nd == 0 and ob.nd == 0:
-        oa_data = <double *>oa.data
-        ob_data = <double *>ob.data
-        scalar = 1
         
     if size is None:
-        if scalar:
-            return func(state, oa_data[0], ob_data[0])
-        else:
-            multi = <broadcast> PyArray_MultiIterNew(2, <void *>oa, <void *>ob)
-            array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
-            array_data = <double *>array.data
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
-                ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                array_data[i] = func(state, oa_data[0], ob_data[0])
-                PyArray_MultiIter_NEXT(multi)
+        multi = <broadcast> PyArray_MultiIterNew(2, <void *>oa, <void *>ob)
+        array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
+        array_data = <double *>array.data
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
+            ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            array_data[i] = func(state, oa_data[0], ob_data[0])
+            PyArray_MultiIter_NEXT(multi)
     else:
         array = <ndarray>_sp.empty(size, _sp.float64)
         array_data = <double *>array.data
-        if scalar:
-            length = PyArray_SIZE(array)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, oa_data[0], ob_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>oa, <void *>ob)
-            if (multi.size != PyArray_SIZE(array)):
-                raise ValueError("size is not compatible with inputs")                 
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
-                array_data[i] = func(state, oa_data[0], ob_data[0])
-                PyArray_MultiIter_NEXTi(multi, 1)
-                PyArray_MultiIter_NEXTi(multi, 2)
+        multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>oa, <void *>ob)
+        if (multi.size != PyArray_SIZE(array)):
+            raise ValueError("size is not compatible with inputs")                 
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+            array_data[i] = func(state, oa_data[0], ob_data[0])
+            PyArray_MultiIter_NEXTi(multi, 1)
+            PyArray_MultiIter_NEXTi(multi, 2)
     return array
 
+cdef object cont3_array_sc(rk_state *state, rk_cont3 func, object size, double a, 
+                           double b, double c):
+
+    cdef double *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+    
+    if size is None:
+        return func(state, a, b, c)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.Float64)
+        length = PyArray_SIZE(array)
+        array_data = <double *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, a, b, c)
+        return array
+
 cdef object cont3_array(rk_state *state, rk_cont3 func, object size, ndarray oa, 
     ndarray ob, ndarray oc):
 
@@ -239,46 +263,30 @@
     cdef npy_intp length
     cdef npy_intp i
     cdef broadcast multi
-    cdef int scalar
-
-    scalar = 0
-    if (oa.nd ==0 and ob.nd==0 and oc.nd == 0):
-        oa_data = <double *>oa.data
-        ob_data = <double *>ob.data
-        oc_data = <double *>oc.data
-        scalar = 1
         
     if size is None:
-        if scalar:
-            return func(state, oa_data[0], ob_data[0], oc_data[0])
-        else:
-            multi = <broadcast> PyArray_MultiIterNew(3, <void *>oa, <void *>ob, <void *>oc)
-            array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
-            array_data = <double *>array.data
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
-                ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                oc_data = <double *>PyArray_MultiIter_DATA(multi, 2)
-                array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
-                PyArray_MultiIter_NEXT(multi)
+        multi = <broadcast> PyArray_MultiIterNew(3, <void *>oa, <void *>ob, <void *>oc)
+        array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_DOUBLE)
+        array_data = <double *>array.data
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 0)
+            ob_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            oc_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+            array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
+            PyArray_MultiIter_NEXT(multi)
     else:
         array = <ndarray>_sp.empty(size, _sp.float64)
         array_data = <double *>array.data        
-        if scalar:
-            length = PyArray_SIZE(array)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>oa,
-                                                    <void *>ob, <void *>oc)
-            if (multi.size != PyArray_SIZE(array)):
-                raise ValueError("size is not compatible with inputs")                 
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
-                oc_data = <double *>PyArray_MultiIter_DATA(multi, 3)
-                array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
-                PyArray_MultiIter_NEXT(multi)                
+        multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>oa,
+                                                <void *>ob, <void *>oc)
+        if (multi.size != PyArray_SIZE(array)):
+            raise ValueError("size is not compatible with inputs")                 
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            ob_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+            oc_data = <double *>PyArray_MultiIter_DATA(multi, 3)
+            array_data[i] = func(state, oa_data[0], ob_data[0], oc_data[0])
+            PyArray_MultiIter_NEXT(multi)                
     return array
 
 cdef object disc0_array(rk_state *state, rk_disc0 func, object size):
@@ -297,6 +305,22 @@
             array_data[i] = func(state)
         return array
 
+cdef object discnp_array_sc(rk_state *state, rk_discnp func, object size, long n, double p):
+    cdef long *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+
+    if size is None:
+        return func(state, n, p)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.Int)
+        length = PyArray_SIZE(array)
+        array_data = <long *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, n, p)
+        return array
+
 cdef object discnp_array(rk_state *state, rk_discnp func, object size, ndarray on, ndarray op):
     cdef long *array_data
     cdef ndarray array "arrayObject"
@@ -304,47 +328,49 @@
     cdef npy_intp i
     cdef double *op_data
     cdef long *on_data
-    cdef int scalar
     cdef broadcast multi
-
-    scalar = 0
-    if (on.nd == 0 and op.nd == 0):
-        on_data = <long *>on.data
-        op_data = <double *>op.data
-        scalar = 1
         
     if size is None:
-        if (scalar):
-            return func(state, on_data[0], op_data[0])
-        else:
-            multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
-            array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
-            array_data = <long *>array.data
-            for i from 0 <= i < multi.size:
-                on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
-                op_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                array_data[i] = func(state, on_data[0], op_data[0])
-                PyArray_MultiIter_NEXT(multi)
+        multi = <broadcast> PyArray_MultiIterNew(2, <void *>on, <void *>op)
+        array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
+        array_data = <long *>array.data
+        for i from 0 <= i < multi.size:
+            on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
+            op_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            array_data[i] = func(state, on_data[0], op_data[0])
+            PyArray_MultiIter_NEXT(multi)
     else:
-        array = <ndarray>_sp.empty(size, int)        
-        if (scalar):
-            length = PyArray_SIZE(array)
-            array_data = <long *>array.data
-            for i from 0 <= i < length:
-                array_data[i] = func(state, on_data[0], op_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
-            if (multi.size != PyArray_SIZE(array)):
-                raise ValueError("size is not compatible with inputs")                 
-            for i from 0 <= i < multi.size:
-                on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
-                op_data = <double *>PyArray_MultiIter_DATA(multi, 2)
-                array_data[i] = func(state, on_data[0], op_data[0])
-                PyArray_MultiIter_NEXTi(multi, 1)
-                PyArray_MultiIter_NEXTi(multi, 2)
+        array = <ndarray>_sp.empty(size, int)
+        array_data = <long *>array.data
+        multi = <broadcast>PyArray_MultiIterNew(3, <void*>array, <void *>on, <void *>op)
+        if (multi.size != PyArray_SIZE(array)):
+            raise ValueError("size is not compatible with inputs")                 
+        for i from 0 <= i < multi.size:
+            on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+            op_data = <double *>PyArray_MultiIter_DATA(multi, 2)
+            array_data[i] = func(state, on_data[0], op_data[0])
+            PyArray_MultiIter_NEXTi(multi, 1)
+            PyArray_MultiIter_NEXTi(multi, 2)
             
     return array
 
+cdef object discnmN_array_sc(rk_state *state, rk_discnmN func, object size, 
+    long n, long m, long N):
+    cdef long *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+
+    if size is None:
+        return func(state, n, m, N)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.Int)
+        length = PyArray_SIZE(array)
+        array_data = <long *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, n, m, N)
+        return array
+
 cdef object discnmN_array(rk_state *state, rk_discnmN func, object size, 
     ndarray on, ndarray om, ndarray oN):
     cdef long *array_data
@@ -355,49 +381,49 @@
     cdef npy_intp length
     cdef npy_intp i
     cdef broadcast multi
-    cdef int scalar
 
-    scalar = 0
-    if (on.nd == 0 and om.nd == 0 and oN.nd==0):
-        scalar = 1
-        on_data = <long *>on.data
-        om_data = <long *>om.data
-        oN_data = <long *>oN.data        
-
     if size is None:
-        if (scalar):
-            return func(state, on_data[0], om_data[0], oN_data[0])
-        else:
-            multi = <broadcast> PyArray_MultiIterNew(3, <void *>on, <void *>om, <void *>oN)
-            array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
-            array_data = <long *>array.data
-            for i from 0 <= i < multi.size:
-                on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
-                om_data = <long *>PyArray_MultiIter_DATA(multi, 1)
-                oN_data = <long *>PyArray_MultiIter_DATA(multi, 2)                
-                array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
-                PyArray_MultiIter_NEXT(multi)
+        multi = <broadcast> PyArray_MultiIterNew(3, <void *>on, <void *>om, <void *>oN)
+        array = <ndarray> PyArray_SimpleNew(multi.nd, multi.dimensions, NPY_LONG)
+        array_data = <long *>array.data
+        for i from 0 <= i < multi.size:
+            on_data = <long *>PyArray_MultiIter_DATA(multi, 0)
+            om_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+            oN_data = <long *>PyArray_MultiIter_DATA(multi, 2)                
+            array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
+            PyArray_MultiIter_NEXT(multi)
     else:
         array = <ndarray>_sp.empty(size, int)
         array_data = <long *>array.data
-        if (scalar):
-            length = PyArray_SIZE(array)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>on, <void *>om,
-                                                    <void *>oN)
-            if (multi.size != PyArray_SIZE(array)):
-                raise ValueError("size is not compatible with inputs") 
-            for i from 0 <= i < multi.size:
-                on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
-                om_data = <long *>PyArray_MultiIter_DATA(multi, 2)
-                oN_data = <long *>PyArray_MultiIter_DATA(multi, 3)
-                array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
-                PyArray_MultiIter_NEXT(multi)
+        multi = <broadcast>PyArray_MultiIterNew(4, <void*>array, <void *>on, <void *>om,
+                                                <void *>oN)
+        if (multi.size != PyArray_SIZE(array)):
+            raise ValueError("size is not compatible with inputs") 
+        for i from 0 <= i < multi.size:
+            on_data = <long *>PyArray_MultiIter_DATA(multi, 1)
+            om_data = <long *>PyArray_MultiIter_DATA(multi, 2)
+            oN_data = <long *>PyArray_MultiIter_DATA(multi, 3)
+            array_data[i] = func(state, on_data[0], om_data[0], oN_data[0])
+            PyArray_MultiIter_NEXT(multi)
 
     return array
 
+cdef object discd_array_sc(rk_state *state, rk_discd func, object size, double a):
+    cdef long *array_data
+    cdef ndarray array "arrayObject"
+    cdef long length
+    cdef long i
+
+    if size is None:
+        return func(state, a)
+    else:
+        array = <ndarray>_sp.empty(size, _sp.Int)
+        length = PyArray_SIZE(array)
+        array_data = <long *>array.data
+        for i from 0 <= i < length:
+            array_data[i] = func(state, a)
+        return array
+
 cdef object discd_array(rk_state *state, rk_discd func, object size, ndarray oa):
     cdef long *array_data
     cdef double *oa_data
@@ -406,39 +432,25 @@
     cdef npy_intp i
     cdef broadcast multi
     cdef flatiter itera
-    cdef int scalar 
 
-    scalar = 0
-    if (oa.nd == 0):
-        oa_data = <double *>oa.data
-        scalar =1
-
     if size is None:
-        if (scalar):
-            return func(state, oa_data[0])
-        else:
-            array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG)
-            length = PyArray_SIZE(array)
-            array_data = <long *>array.data
-            itera = <flatiter>PyArray_IterNew(<object>oa)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, (<double *>(itera.dataptr))[0])
-                PyArray_ITER_NEXT(itera)
+        array = <ndarray>PyArray_SimpleNew(oa.nd, oa.dimensions, NPY_LONG)
+        length = PyArray_SIZE(array)
+        array_data = <long *>array.data
+        itera = <flatiter>PyArray_IterNew(<object>oa)
+        for i from 0 <= i < length:
+            array_data[i] = func(state, (<double *>(itera.dataptr))[0])
+            PyArray_ITER_NEXT(itera)
     else:
         array = <ndarray>_sp.empty(size, int)
         array_data = <long *>array.data
-        if (scalar):
-            length = PyArray_SIZE(array)
-            for i from 0 <= i < length:
-                array_data[i] = func(state, oa_data[0])
-        else:
-            multi = <broadcast>PyArray_MultiIterNew(2, <void *>array, <void *>oa)
-            if (multi.size != PyArray_SIZE(array)): 
-                raise ValueError("size is not compatible with inputs")                
-            for i from 0 <= i < multi.size:
-                oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
-                array_data[i] = func(state, oa_data[0])
-                PyArray_MultiIter_NEXTi(multi, 1)
+        multi = <broadcast>PyArray_MultiIterNew(2, <void *>array, <void *>oa)
+        if (multi.size != PyArray_SIZE(array)): 
+            raise ValueError("size is not compatible with inputs")                
+        for i from 0 <= i < multi.size:
+            oa_data = <double *>PyArray_MultiIter_DATA(multi, 1)
+            array_data[i] = func(state, oa_data[0])
+            PyArray_MultiIter_NEXTi(multi, 1)
     return array
 
 cdef double kahan_sum(double *darr, long n):
@@ -598,10 +610,9 @@
         bytes(length) -> str
         """
         cdef void *bytes
-        bytes = PyMem_Malloc(length)
+        bytestring = PyString_FromStringAndSize(NULL, length) 
+        bytes = PyString_AS_STRING(bytestring)
         rk_fill(bytes, length, self.internal_state)
-        bytestring = PyString_FromStringAndSize(<char*>bytes, length)
-        PyMem_Free(bytes)
         return bytestring
 
     def uniform(self, low=0.0, high=1.0, size=None):
@@ -609,10 +620,15 @@
 
         uniform(low=0.0, high=1.0, size=None) -> random values
         """
-        cdef ndarray olow
-        cdef ndarray ohigh
-        cdef ndarray odiff
+        cdef ndarray olow, ohigh, odiff
+        cdef double flow, fhigh
         cdef object temp
+
+        flow = PyFloat_AsDouble(low)
+        fhigh = PyFloat_AsDouble(high)
+        if not PyErr_Occurred():
+            return cont2_array_sc(self.internal_state, rk_uniform, size, flow, fhigh-flow)
+        PyErr_Clear()
         olow = <ndarray>PyArray_FROM_OTF(low, NPY_DOUBLE, NPY_ALIGNED)
         ohigh = <ndarray>PyArray_FROM_OTF(high, NPY_DOUBLE, NPY_ALIGNED)
         temp = _sp.subtract(ohigh, olow)
@@ -677,8 +693,18 @@
 
         normal(loc=0.0, scale=1.0, size=None) -> random values
         """
-        cdef ndarray oloc
-        cdef ndarray oscale
+        cdef ndarray oloc, oscale
+        cdef double floc, fscale
+
+        floc = PyFloat_AsDouble(loc)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_normal, size, floc, fscale)
+
+        PyErr_Clear()
+        
         oloc = <ndarray>PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
         oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0)):
@@ -690,11 +716,22 @@
 
         beta(a, b, size=None) -> random values
         """
-        cdef ndarray oa
-        cdef ndarray ob
+        cdef ndarray oa, ob
+        cdef double fa, fb
+
+        fa = PyFloat_AsDouble(a)
+        fb = PyFloat_AsDouble(b)
+        if not PyErr_Occurred():
+            if fa <= 0:
+                raise ValueError("a <= 0")
+            if fb <= 0:
+                raise ValueError("b <= 0")
+            return cont2_array_sc(self.internal_state, rk_beta, size, fa, fb)
+
+        PyErr_Clear()
+        
         oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
         ob = <ndarray>PyArray_FROM_OTF(b, NPY_DOUBLE, NPY_ALIGNED)
-
         if _sp.any(_sp.less_equal(oa, 0)):
             raise ValueError("a <= 0")
         if _sp.any(_sp.less_equal(ob, 0)):        
@@ -707,6 +744,16 @@
         exponential(scale=1.0, size=None) -> random values
         """
         cdef ndarray oscale
+        cdef double fscale
+
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont1_array_sc(self.internal_state, rk_exponential, size, fscale)
+
+        PyErr_Clear()
+        
         oscale = <ndarray> PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0.0)):
             raise ValueError("scale <= 0")
@@ -725,6 +772,15 @@
         standard_gamma(shape, size=None) -> random values
         """
         cdef ndarray oshape
+        cdef double fshape
+
+        fshape = PyFloat_AsDouble(shape)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("shape <= 0")
+            return cont1_array_sc(self.internal_state, rk_standard_gamma, size, fshape)
+
+        PyErr_Clear()
         oshape = <ndarray> PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oshape, 0.0)):
             raise ValueError("shape <= 0")
@@ -735,8 +791,19 @@
 
         gamma(shape, scale=1.0, size=None) -> random values
         """
-        cdef ndarray oshape
-        cdef ndarray oscale
+        cdef ndarray oshape, oscale
+        cdef double fshape, fscale
+
+        fshape = PyFloat_AsDouble(shape)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fshape <= 0:
+                raise ValueError("shape <= 0")
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_gamma, size, fshape, fscale)
+
+        PyErr_Clear()
         oshape = <ndarray>PyArray_FROM_OTF(shape, NPY_DOUBLE, NPY_ALIGNED)
         oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oshape, 0.0)):
@@ -750,8 +817,20 @@
 
         f(dfnum, dfden, size=None) -> random values
         """
-        cdef ndarray odfnum
-        cdef ndarray odfden
+        cdef ndarray odfnum, odfden
+        cdef double fdfnum, fdfden
+
+        fdfnum = PyFloat_AsDouble(dfnum)
+        fdfden = PyFloat_AsDouble(dfden)
+        if not PyErr_Occurred():
+            if fdfnum <= 0:
+                raise ValueError("shape <= 0")
+            if fdfden <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_f, size, fdfnum, fdfden)
+
+        PyErr_Clear()
+
         odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
         odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(odfnum, 0.0)):
@@ -764,10 +843,25 @@
         """Noncentral F distribution.
 
         noncentral_f(dfnum, dfden, nonc, size=None) -> random values
-        """
-        cdef ndarray odfnum
-        cdef ndarray odfden
-        cdef ndarray ononc
+        """        
+        cdef ndarray odfnum, odfden, ononc
+        cdef double fdfnum, fdfden, fnonc
+
+        fdfnum = PyFloat_AsDouble(dfnum)
+        fdfden = PyFloat_AsDouble(dfden)
+        fnonc = PyFloat_AsDouble(nonc)
+        if not PyErr_Occurred():
+            if fdfnum <= 1:
+                raise ValueError("dfnum <= 1")
+            if fdfden <= 0:
+                raise ValueError("dfden <= 0")
+            if fnonc < 0:
+                raise ValueError("nonc < 0")
+            return cont3_array_sc(self.internal_state, rk_noncentral_f, size,
+                                  fdfnum, fdfden, fnonc)
+
+        PyErr_Clear()
+        
         odfnum = <ndarray>PyArray_FROM_OTF(dfnum, NPY_DOUBLE, NPY_ALIGNED)
         odfden = <ndarray>PyArray_FROM_OTF(dfden, NPY_DOUBLE, NPY_ALIGNED)
         ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)        
@@ -787,6 +881,16 @@
         chisquare(df, size=None) -> random values
         """
         cdef ndarray odf
+        cdef double fdf
+
+        fdf = PyFloat_AsDouble(df)
+        if not PyErr_Occurred():
+            if fdf <= 0:
+                raise ValueError("df <= 0")
+            return cont1_array(self.internal_state, rk_chisquare, size, fdf)
+
+        PyErr_Clear()
+
         odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(odf, 0.0)):        
             raise ValueError("df <= 0")
@@ -797,8 +901,20 @@
 
         noncentral_chisquare(df, nonc, size=None) -> random values
         """
-        cdef ndarray odf
-        cdef ndarray ononc
+        cdef ndarray odf, ononc
+        cdef double fdf, fnonc
+        fdf = PyFloat_AsDouble(df)
+        fnonc = PyFloat_AsDouble(nonc)
+        if not PyErr_Occurred():
+            if fdf <= 1:
+                raise ValueError("df <= 0")
+            if fnonc <= 0:
+                raise ValueError("nonc <= 0")
+            return cont2_array_sc(self.internal_state, rk_noncentral_chisquare,
+                                  size, fdf, fnonc)
+        
+        PyErr_Clear()
+
         odf = <ndarray>PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
         ononc = <ndarray>PyArray_FROM_OTF(nonc, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(odf, 0.0)):
@@ -821,6 +937,16 @@
         standard_t(df, size=None)
         """
         cdef ndarray odf
+        cdef double fdf
+
+        fdf = PyFloat_AsDouble(df)
+        if not PyErr_Occurred():
+            if fdf <= 0:
+                raise ValueError("df <= 0")
+            return cont1_array_sc(self.internal_state, rk_standard_t, size, fdf)
+
+        PyErr_Clear()
+        
         odf = <ndarray> PyArray_FROM_OTF(df, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(odf, 0.0)):        
             raise ValueError("df <= 0")
@@ -832,11 +958,21 @@
 
         vonmises(mu, kappa, size=None)
         """
-        cdef ndarray omu
-        cdef ndarray okappa
+        cdef ndarray omu, okappa
+        cdef double fmu, fkappa
+
+        fmu = PyFloat_AsDouble(mu)
+        fkappa = PyFloat_AsDouble(kappa)
+        if not PyErr_Occurred():
+            if fkappa < 0:
+                raise ValueError("kappa < 0")
+            return cont2_array_sc(self.internal_state, rk_vonmises, size, fmu, fkappa)
+
+        PyErr_Clear()
+        
         omu = <ndarray> PyArray_FROM_OTF(mu, NPY_DOUBLE, NPY_ALIGNED)
         okappa = <ndarray> PyArray_FROM_OTF(kappa, NPY_DOUBLE, NPY_ALIGNED)
-        if _sp.any(_sp.less_equal(okappa, 0.0)):        
+        if _sp.any(_sp.less(okappa, 0.0)):
             raise ValueError("kappa < 0")
         return cont2_array(self.internal_state, rk_vonmises, size, omu, okappa)
 
@@ -846,28 +982,58 @@
         pareto(a, size=None)
         """
         cdef ndarray oa
+        cdef double fa
+
+        fa = PyFloat_AsDouble(a)
+        if not PyErr_Occurred():
+            if fa <= 0:
+                raise ValueError("a <= 0")
+            return cont1_array_sc(self.internal_state, rk_pareto, size, fa)
+
+        PyErr_Clear()
+        
         oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oa, 0.0)):        
             raise ValueError("a <= 0")
         return cont1_array(self.internal_state, rk_pareto, size, oa)
 
-    def weibull(self, double a, size=None):
+    def weibull(self, a, size=None):
         """Weibull distribution.
 
         weibull(a, size=None)
         """
         cdef ndarray oa
+        cdef double fa
+
+        fa = PyFloat_AsDouble(a)
+        if not PyErr_Occurred():
+            if fa <= 0:
+                raise ValueError("a <= 0")
+            return cont1_array_sc(self.internal_state, rk_weibull, size, fa)
+
+        PyErr_Clear()
+        
         oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oa, 0.0)):                
             raise ValueError("a <= 0")
         return cont1_array(self.internal_state, rk_weibull, size, oa)
 
-    def power(self, double a, size=None):
+    def power(self, a, size=None):
         """Power distribution.
 
         power(a, size=None)
         """
         cdef ndarray oa
+        cdef double fa
+
+        fa = PyFloat_AsDouble(a)
+        if not PyErr_Occurred():
+            if fa <= 0:
+                raise ValueError("a <= 0")
+            return cont1_array_sc(self.internal_state, rk_power, size, fa)
+
+        PyErr_Clear()
+
         oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oa, 0.0)):       
             raise ValueError("a <= 0")
@@ -878,8 +1044,17 @@
         
         laplace(loc=0.0, scale=1.0, size=None)
         """
-        cdef ndarray oloc
-        cdef ndarray oscale
+        cdef ndarray oloc, oscale
+        cdef double floc, fscale
+
+        floc = PyFloat_AsDouble(loc)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_laplace, size, floc, fscale)
+
+        PyErr_Clear()
         oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
         oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0.0)):        
@@ -891,8 +1066,17 @@
         
         gumbel(loc=0.0, scale=1.0, size=None)
         """
-        cdef ndarray oloc
-        cdef ndarray oscale
+        cdef ndarray oloc, oscale
+        cdef double floc, fscale
+
+        floc = PyFloat_AsDouble(loc)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_gumbel, size, floc, fscale)
+
+        PyErr_Clear()
         oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
         oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0.0)):        
@@ -904,8 +1088,17 @@
         
         logistic(loc=0.0, scale=1.0, size=None)
         """
-        cdef ndarray oloc
-        cdef ndarray oscale
+        cdef ndarray oloc, oscale
+        cdef double floc, fscale
+
+        floc = PyFloat_AsDouble(loc)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_logistic, size, floc, fscale)
+
+        PyErr_Clear()
         oloc = PyArray_FROM_OTF(loc, NPY_DOUBLE, NPY_ALIGNED)
         oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0.0)):        
@@ -922,8 +1115,19 @@
         
         lognormal(mean=0.0, sigma=1.0, size=None)
         """
-        cdef ndarray omean
-        cdef ndarray osigma
+        cdef ndarray omean, osigma
+        cdef double fmean, fsigma        
+
+        fmean = PyFloat_AsDouble(mean)
+        fsigma = PyFloat_AsDouble(sigma)
+
+        if not PyErr_Occurred():
+            if fsigma <= 0:
+                raise ValueError("sigma <= 0")
+            return cont2_array_sc(self.internal_state, rk_lognormal, size, fmean, fsigma)
+
+        PyErr_Clear()
+
         omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED)
         osigma = PyArray_FROM_OTF(sigma, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(osigma, 0.0)):
@@ -936,6 +1140,17 @@
         rayleigh(scale=1.0, size=None)
         """
         cdef ndarray oscale
+        cdef double fscale
+
+        fscale = PyFloat_AsDouble(scale)
+
+        if not PyErr_Occurred():
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont1_array_sc(self.internal_state, rk_rayleigh, size, fscale)
+
+        PyErr_Clear()
+
         oscale = <ndarray>PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oscale, 0.0)):        
             raise ValueError("scale <= 0.0")
@@ -946,8 +1161,19 @@
         
         wald(mean, scale, size=None)
         """
-        cdef ndarray omean
-        cdef ndarray oscale
+        cdef ndarray omean, oscale
+        cdef double fmean, fscale
+
+        fmean = PyFloat_AsDouble(mean)
+        fscale = PyFloat_AsDouble(scale)
+        if not PyErr_Occurred():
+            if fmean <= 0:
+                raise ValueError("mean <= 0")
+            if fscale <= 0:
+                raise ValueError("scale <= 0")
+            return cont2_array_sc(self.internal_state, rk_wald, size, fmean, fscale)
+
+        PyErr_Clear()
         omean = PyArray_FROM_OTF(mean, NPY_DOUBLE, NPY_ALIGNED)
         oscale = PyArray_FROM_OTF(scale, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(omean,0.0)):
@@ -956,15 +1182,31 @@
             raise ValueError("scale <= 0.0")
         return cont2_array(self.internal_state, rk_wald, size, omean, oscale)
 
+
+
     def triangular(self, left, mode, right, size=None):
         """Triangular distribution starting at left, peaking at mode, and 
         ending at right (left <= mode <= right).
         
         triangular(left, mode, right, size=None)
         """
-        cdef ndarray oleft
-        cdef ndarray omode
-        cdef ndarray oright
+        cdef ndarray oleft, omode, oright
+        cdef double fleft, fmode, fright
+
+        fleft = PyFloat_AsDouble(left)
+        fright = PyFloat_AsDouble(right)
+        fmode = PyFloat_AsDouble(mode)
+        if not PyErr_Occurred():
+            if fleft > fmode:
+                raise ValueError("left > mode")
+            if fmode > fright:
+                raise ValueError("mode > right")
+            if fleft == fright:
+                raise ValueError("left == right")
+            return cont3_array_sc(self.internal_state, rk_triangular, size, fleft,
+                                  fmode, fright)
+        
+        PyErr_Clear()            
         oleft = <ndarray>PyArray_FROM_OTF(left, NPY_DOUBLE, NPY_ALIGNED)
         omode = <ndarray>PyArray_FROM_OTF(mode, NPY_DOUBLE, NPY_ALIGNED)
         oright = <ndarray>PyArray_FROM_OTF(right, NPY_DOUBLE, NPY_ALIGNED)        
@@ -984,8 +1226,23 @@
 
         binomial(n, p, size=None) -> random values
         """
-        cdef ndarray on
-        cdef ndarray op
+        cdef ndarray on, op
+        cdef long ln
+        cdef double fp
+
+        fp = PyFloat_AsDouble(p)
+        ln = PyInt_AsLong(n)
+        if not PyErr_Occurred():
+            if ln <= 0:
+                raise ValueError("n <= 0")
+            if fp < 0:
+                raise ValueError("p < 0")
+            elif fp > 1:
+                raise ValueError("p > 1")
+            return discnp_array_sc(self.internal_state, rk_binomial, size, ln, fp)
+
+        PyErr_Clear()
+        
         on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED)
         op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)        
         if _sp.any(_sp.less_equal(n, 0)):
@@ -1003,6 +1260,23 @@
         """
         cdef ndarray on
         cdef ndarray op
+        cdef long ln
+        cdef double fp
+
+        fp = PyFloat_AsDouble(p)
+        ln = PyInt_AsLong(n)
+        if not PyErr_Occurred():
+            if ln <= 0:
+                raise ValueError("n <= 0")
+            if fp < 0:
+                raise ValueError("p < 0")
+            elif fp > 1:
+                raise ValueError("p > 1")
+            return discnp_array_sc(self.internal_state, rk_negative_binomial,
+                                   size, ln, fp)
+
+        PyErr_Clear()            
+        
         on = <ndarray>PyArray_FROM_OTF(n, NPY_LONG, NPY_ALIGNED)
         op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)        
         if _sp.any(_sp.less_equal(n, 0)):
@@ -1020,6 +1294,15 @@
         poisson(lam=1.0, size=None) -> random values
         """
         cdef ndarray olam
+        cdef double flam
+        flam = PyFloat_AsDouble(lam)
+        if not PyErr_Occurred():
+            if lam < 0:
+                raise ValueError("lam < 0")
+            return discd_array_sc(self.internal_state, rk_poisson, size, flam)
+
+        PyErr_Clear()
+        
         olam = <ndarray>PyArray_FROM_OTF(lam, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less(olam, 0)):
             raise ValueError("lam < 0")
@@ -1031,6 +1314,16 @@
         zipf(a, size=None)
         """
         cdef ndarray oa
+        cdef double fa
+
+        fa = PyFloat_AsDouble(a)
+        if not PyErr_Occurred():
+            if fa <= 1.0:
+                raise ValueError("a <= 1.0")
+            return discd_array_sc(self.internal_state, rk_zipf, size, fa)
+
+        PyErr_Clear()
+        
         oa = <ndarray>PyArray_FROM_OTF(a, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less_equal(oa, 1.0)):
             raise ValueError("a <= 1.0")
@@ -1043,6 +1336,19 @@
         geometric(p, size=None)
         """
         cdef ndarray op
+        cdef double fp
+
+        fp = PyFloat_AsDouble(p)
+        if not PyErr_Occurred():
+            if fp < 0.0:
+                raise ValueError("p < 0.0")
+            if fp > 1.0:
+                raise ValueError("p > 1.0")
+            return discd_array_sc(self.internal_state, rk_geometric, size, fp)
+
+        PyErr_Clear()
+
+        
         op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less(op, 0.0)):        
             raise ValueError("p < 0.0")
@@ -1060,10 +1366,27 @@
         
         hypergeometric(ngood, nbad, nsample, size=None)        
         """
-        cdef ndarray ongood
-        cdef ndarray onbad
-        cdef ndarray onsample
+        cdef ndarray ongood, onbad, onsample
+        cdef long lngood, lnbad, lnsample
 
+        lngood = PyInt_AsLong(ngood)
+        lnbad = PyInt_AsLong(nbad)
+        lnsample = PyInt_AsLong(nsample)
+        if not PyErr_Occurred():
+            if ngood < 1:
+                raise ValueError("ngood < 1")
+            if nbad < 1:
+                raise ValueError("nbad < 1")
+            if nsample < 1:
+                raise ValueError("nsample < 1")
+            if ngood + nbad < nsample:
+                raise ValueError("ngood + nbad < nsample")
+            return discnmN_array_sc(self.internal_state, rk_hypergeometric, size,
+                                    lngood, lnbad, lnsample)
+
+
+        PyErr_Clear()
+
         ongood = <ndarray>PyArray_FROM_OTF(ngood, NPY_LONG, NPY_ALIGNED)
         onbad = <ndarray>PyArray_FROM_OTF(nbad, NPY_LONG, NPY_ALIGNED)
         onsample = <ndarray>PyArray_FROM_OTF(nsample, NPY_LONG, NPY_ALIGNED)
@@ -1071,10 +1394,10 @@
             raise ValueError("ngood < 1")
         if _sp.any(_sp.less(onbad, 1)):
             raise ValueError("nbad < 1")
+        if _sp.any(_sp.less(onsample, 1)):
+            raise ValueError("nsample < 1")        
         if _sp.any(_sp.less(_sp.add(ongood, onbad),onsample)):
             raise ValueError("ngood + nbad < nsample")
-        if _sp.any(_sp.less(onsample, 1)):
-            raise ValueError("nsample < 1")
         return discnmN_array(self.internal_state, rk_hypergeometric, size,
             ongood, onbad, onsample)
 
@@ -1084,6 +1407,18 @@
         logseries(p, size=None)
         """
         cdef ndarray op
+        cdef double fp
+
+        fp = PyFloat_AsDouble(p)
+        if not PyErr_Occurred():
+            if fp < 0.0:
+                raise ValueError("p < 0.0")
+            if fp > 1.0:
+                raise ValueError("p > 1.0")
+            return discd_array_sc(self.internal_state, rk_logseries, size, fp)
+
+        PyErr_Clear()
+        
         op = <ndarray>PyArray_FROM_OTF(p, NPY_DOUBLE, NPY_ALIGNED)
         if _sp.any(_sp.less(op, 0.0)):        
             raise ValueError("p < 0.0")



More information about the Numpy-svn mailing list