MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / randBytes

Method randBytes

source/core/StarRandom.cpp:129–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

127}
128
129void 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
142ByteArray RandomSource::randBytes(size_t len) {
143 ByteArray array(len, 0);

Callers 1

randBytesFunction · 0.80

Calls 2

randBytesFunction · 0.85
ptrMethod · 0.45

Tested by

no test coverage detected