#include "Python.h" #include "arrayobject.h" #include "ranlib.h" static PyObject *ErrorObject; /* ----------------------------------------------------- */ static char random_sample__doc__[] =""; static PyObject * random_sample(PyObject *self, PyObject *args) { PyArrayObject *op; double *dptr; int i, n=-1, nd; if (!PyArg_ParseTuple(args, "|i", &n)) return NULL; /*Create a 1 dimensional array of dimensions of type double*/ nd = n == -1 ? 0:1; op = (PyArrayObject *)PyArray_FromDims(1, &n, PyArray_DOUBLE); if (op == NULL) return NULL; if (n == -1) n = 1; dptr = (double *)op->data; for(i=0; i