📄 sample.h
字号:
#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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -