---
title: 释放随机数流函数
description: "释放stream结构体内存，调用此函数后此stream不能再被使用。"
url: https://www.hikunpeng.com/document/detail/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0488.html
sourcePath: /source/zh/kunpenghpcs/hpckit/devg/kunpengaccel_kml_0488.html
indexId: 31710fbf282380b69af07deec8b0ea1a9385067ac53581093b61f5d56bdcfbac61
---
# 释放随机数流函数

释放stream结构体内存，调用此函数后此stream不能再被使用。

#### 接口定义

int vslDeleteStream(VSLStreamStatePtr *stream);


#### 参数

| 参数名 | 类型 | 描述 | 输入/输出 |
| --- | --- | --- | --- |
| stream | VSLStreamStatePtr类型指针 | 指向随机数流结构体的指针。 | 输入 |


#### 依赖

#include "krng.h"


#### 示例

```
#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;
}
```
