MCPcopy Create free account
hub / github.com/VCVRack/Rack / buffer

Function buffer

include/random.hpp:145–157  ·  view source on GitHub ↗

Fills an array with random bytes. */

Source from the content-addressed store, hash-verified

143
144/** Fills an array with random bytes. */
145inline void buffer(uint8_t* out, size_t len) {
146 Xoroshiro128Plus& rng = local();
147 for (size_t i = 0; i < len; i += 4) {
148 uint64_t r = rng();
149 out[i] = r;
150 if (i + 1 < len)
151 out[i + 1] = r >> 8;
152 if (i + 2 < len)
153 out[i + 2] = r >> 16;
154 if (i + 3 < len)
155 out[i + 3] = r >> 24;
156 }
157}
158
159/** Creates a vector of random bytes. */
160inline std::vector<uint8_t> vector(size_t len) {

Callers 1

vectorFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected