我要评分
获取效率
正确性
完整性
易理解

Function for Releasing a Random Number Stream

Release the memory in the stream structure. The stream cannot be used anymore after this function is called.

Interface Definition

int vslDeleteStream(VSLStreamStatePtr *stream);

Parameters

Parameter

Type

Description

Input/Output

stream

Pointer of the VSLStreamStatePtr type

Pointer to the random number stream structure.

Input

Dependencies

#include "krng.h"

Examples

#include <stdio.h>
#include <stdlib.h>
#include "krng.h"
int main()
{
   /* initialize stream with given BRNG type and seed */
    VSLStreamStatePtr stream;
    unsigned seed = 42;
    int errcode = vslNewStream(&stream, VSL_BRNG_MCG59, seed);
    if (errcode != VSL_STATUS_OK) {
        fprintf(stderr, "Failure in newstream\n");
        return 0;
    }

    /* deinitialize the stream */
    errcode = vslDeleteStream(&stream);
    if (errcode != VSL_STATUS_OK) {
        fprintf(stderr, "Failure in deleting stream\n");
        return 0;
    }
    return 0;
}