| 127 | } |
| 128 | |
| 129 | void RandomSource::randBytes(char* buf, size_t len) { |
| 130 | while (len) { |
| 131 | uint32_t ui = gen32(); |
| 132 | for (size_t i = 0; i < 4; ++i) { |
| 133 | if (len) { |
| 134 | *buf = (char)(ui >> (i * 8)); |
| 135 | --len; |
| 136 | ++buf; |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | |
| 142 | ByteArray RandomSource::randBytes(size_t len) { |
| 143 | ByteArray array(len, 0); |