This uses the approximation to a Gaussian via * binomial distribution * * This procedure consumes 2*NewHopeB bits * */
| 18 | * |
| 19 | */ |
| 20 | int DiscreteGauss::sample(PRNG &G, int stretch) const |
| 21 | { |
| 22 | int s= 0; |
| 23 | // stretch refers to the standard deviation |
| 24 | int B = NewHopeB * stretch * stretch; |
| 25 | for (int i = 0; i < B; i++) |
| 26 | { |
| 27 | s += G.get_bit(); |
| 28 | s -= G.get_bit(); |
| 29 | } |
| 30 | return s; |
| 31 | } |
| 32 | |
| 33 | |
| 34 |
no test coverage detected