(p)
| 14587 | |
| 14588 | var geometric = (function sourceRandomGeometric(source) { |
| 14589 | function randomGeometric(p) { |
| 14590 | if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p"); |
| 14591 | if (p === 0) return () => Infinity; |
| 14592 | if (p === 1) return () => 1; |
| 14593 | p = Math.log1p(-p); |
| 14594 | return function() { |
| 14595 | return 1 + Math.floor(Math.log1p(-source()) / p); |
| 14596 | }; |
| 14597 | } |
| 14598 | |
| 14599 | randomGeometric.source = sourceRandomGeometric; |
| 14600 |
nothing calls this directly
no outgoing calls
no test coverage detected