Better testing for random

This commit is contained in:
Imbus 2025-10-01 03:39:02 +02:00
parent e8b2c1ae56
commit 70f78dfa26

View file

@ -1,11 +1,11 @@
#include <endian.h>
#include <badrand.h>
#include <hexdump.h>
#include <assert.h> #include <assert.h>
#include <badrand.h>
#include <banner.h> #include <banner.h>
#include <buddy.h> #include <buddy.h>
#include <config.h> #include <config.h>
#include <endian.h>
#include <freelist.h> #include <freelist.h>
#include <hexdump.h>
#include <memory.h> #include <memory.h>
#include <panic.h> #include <panic.h>
#include <proc.h> #include <proc.h>
@ -100,8 +100,10 @@ void start() {
} }
{ {
char buffer[128]; char buffer[128];
memset(buffer, 0, 128);
assert(!looks_random(buffer, 128));
badrand_buf(buffer, 128); badrand_buf(buffer, 128);
hexdump(buffer, 128); assert(looks_random(buffer, 128));
} }
kprintf("To exit qemu, press CTRL+a followed by x\n"); kprintf("To exit qemu, press CTRL+a followed by x\n");