Rate This Document
Findability
Accuracy
Completeness
Readability

Hypergeometric Distribution

Generate a random number vector that conforms to hypergeometric distribution.

Interface Definition

KmlVslResult kml_vsl_rhyper(VslPolicy *policy, N01type normal_method, int len, double *dst, int m, int n, int k)

Probability Density Function

Parameters

Parameter

Type

Description

Input/Output

len

int

Length of the input and output

Input

m

int

M parameter

Input

n

int

N parameter

Input

k

int

K parameter

Input

dst

Pointer to data of the int type.

Pointer to the result

Output

Policy

Pointer to data of the VslPolicy type.

Pointer to the random number generator structure

Input

Normal_method

N01type enumeration

Algorithm for generating normal distribution

Input

Dependencies

#include "kvsl.h"

Examples

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include "kvsl.h"
int main()
{
    VslPolicy *policy;
    kml_vsl_init(&policy, LECUYER_CMRG, time(NULL));
    int len = 10;
    int *dst = (int *)malloc(sizeof(int) * len);
    int a = kml_vsl_rhyper(policy, BOX_MULLER, len, dst, 10, 2, 3);
    for (int i = 0; i < len; i++) {
        printf("%d ", dst[i]);
    }
    printf("\n");
    kml_vsl_destroy(policy);
}