chooseRandom picks a payload size (in bytes) for a particular range. This is done with a uniform distribution.
()
| 70 | // chooseRandom picks a payload size (in bytes) for a particular range. This is |
| 71 | // done with a uniform distribution. |
| 72 | func (pcr *payloadCurveRange) chooseRandom() int { |
| 73 | if pcr.from == pcr.to { // fast path |
| 74 | return int(pcr.from) |
| 75 | } |
| 76 | |
| 77 | return int(rand.Int32N(pcr.to-pcr.from+1) + pcr.from) |
| 78 | } |
| 79 | |
| 80 | // sha256file is a helper function that returns a hex string matching the |
| 81 | // SHA-256 sum of the input file. |