function* generator() {
for (let i = 0; i < 2; i += 1) {
yield i;
}
}
const gen = generator();
console.log(gen.next().value); // 0
console.log(gen.next().value); // 1
console.log(gen.next().value); // undefined
$e = count($d) - 1;
$f = false;
$g = 0;
$h = 0;
if ($c < 0) {
$c = -$c;
$f = true;
}
$i = 2 / (2 + $c);
$j = 4 * $i - 2;
for (; $e > 0; $e--) {
$k = $g;
$g = $j * $g - $h + $d[$e];
$h = $k;
}
$l = $i * exp(-$c * $c + 0.5 * ($d[0] + $j * $g) - $h);
return $f ? ($l - 1) : (1 - $l);