luby序列生成代码
static double luby(double y, int x) {
// Find the finite subsequence that contains index 'x', and the
// size of that subsequence:
int size, seq;
for (size = 1, seq = 0; size < x + 1; seq++, size = 2 * size + 1);
while (size - 1 != x) {
size = (size - 1) >> 1;
seq--;
x = x % size;
}
return pow(y, seq);
}
本文来自博客园,作者:seonwee,转载请注明原文链接:https://www.cnblogs.com/seonwee/p/18440052

浙公网安备 33010602011771号