better random

This commit is contained in:
Aaron Culliney
2013-07-07 13:07:26 -07:00
parent 8a4f8284b1
commit 5f50068fcd

View File

@@ -723,11 +723,14 @@ static void c_initialize_firsttime()
} }
void c_read_random() { void c_read_random() {
random_value = (unsigned char)(rand() >> 8); static unsigned int seed=0;
if (!seed) {
seed = time(NULL);
}
random_value = (unsigned char)rand_r(&seed);
} }
static void cpu_thread(void *dummyptr) { static void cpu_thread(void *dummyptr) {
do do
{ {
cpu65_run(); cpu65_run();