Added matlab support.

Modified some c and cpp code to help.
This commit is contained in:
Simon D. Levy
2014-09-15 18:27:38 -04:00
parent e3f41e3599
commit d25f5372f7
16 changed files with 1265 additions and 310 deletions

View File

@@ -19,6 +19,7 @@ along with this code. If not, see <http:#www.gnu.org/licenses/>.
*/
#include "ziggurat.h"
#include "random.h"
#include <stdlib.h>
#include <string.h>
@@ -32,18 +33,33 @@ typedef struct random_t
} random_t;
void * random_init(int seed)
size_t random_size(void)
{
return sizeof(random_t);
}
void * random_new(int seed)
{
random_t * r = (random_t *)malloc(sizeof(random_t));
r->seed = seed;
r4_nor_setup (r->kn, r->fn, r->wn );
random_init(r, seed);
return r;
}
void random_init(void * v, int seed)
{
random_t * r = (random_t *)v;
r->seed = seed;
r4_nor_setup (r->kn, r->fn, r->wn );
}
double random_normal(void * v, double mu, double sigma)
{
random_t * r = (random_t *)v;