sample.h
来自「eC++编译器源码」· C头文件 代码 · 共 33 行
H
33 行
#pragma Sample
/* Floyd's Algorithm CACM 9(Sept. 1987) 754-757. */
/* A random sample of size M out of 1..N i.e. M distinct
random numbers, which lie in the range 1..N */
/* Comments only by Rohit Wad rvw2k */
typedef void *Stream;
void Samples(unsigned int M, unsigned int N, unsigned int &result[]);
/* This procedure produces one random Sample and stores it in the
array result. */
void Open(Stream &s, unsigned int M, unsigned int N, unsigned int &result[]);
/* result holds the first permutation */
/* but, a fixed one. This permutation is simply a descending
series that generates all permutations. */
boolean Next(Stream &s); /* returns remaining permutations of M/N*/
/* The remaining permutations are to be stored in the array
'result' from Open. */
void Close(Stream &s);
/* To deallocate space */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?