mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-03 11:12:27 +00:00
Fix issues with previous commit
This commit is contained in:
parent
2f48a02b44
commit
a0a404a431
8 changed files with 122 additions and 57 deletions
|
@ -16,10 +16,34 @@
|
|||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/stdio/rand.h"
|
||||
#include "libc/testlib/benchmark.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
uint64_t getrandom64(void) {
|
||||
uint64_t x;
|
||||
unassert(getrandom(&x, 8, 0) == 8);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint64_t getentropy64(void) {
|
||||
uint64_t x;
|
||||
unassert(!getentropy(&x, 8));
|
||||
return x;
|
||||
}
|
||||
|
||||
TEST(lemur64, test) {
|
||||
EXPECT_EQ(1819718037028923529, lemur64());
|
||||
EXPECT_EQ(-3120132252617434764, lemur64());
|
||||
}
|
||||
|
||||
BENCH(lemur64, bench) {
|
||||
BENCHMARK(10000, 8, X(lemur64()));
|
||||
BENCHMARK(10000, 4, X(rand()));
|
||||
BENCHMARK(10000, 8, X(_rand64()));
|
||||
BENCHMARK(10000, 8, X(rdrand()));
|
||||
BENCHMARK(10000, 8, X(rdseed()));
|
||||
BENCHMARK(10000, 8, X(getrandom64()));
|
||||
BENCHMARK(10000, 8, X(getentropy64()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue