the final solution to the randomness problem
This commit is contained in:
parent
f63b445e52
commit
a7cb9a7383
@ -24,6 +24,8 @@ void jsw_seed ( unsigned long s )
|
||||
* ( x[i - 1] ^ ( x[i - 1] >> 30 ) ) + i );
|
||||
x[i] &= 0xffffffffUL;
|
||||
}
|
||||
|
||||
next = 0;
|
||||
}
|
||||
|
||||
/* Mersenne Twister */
|
||||
@ -70,4 +72,4 @@ unsigned jsw_time_seed()
|
||||
seed = seed * ( UCHAR_MAX + 2U ) + p[i];
|
||||
|
||||
return seed;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ random_seed_set(u64 seed)
|
||||
void
|
||||
random_seed_time_set(void)
|
||||
{
|
||||
jsw_time_seed();
|
||||
random_seed_set(jsw_time_seed());
|
||||
}
|
||||
|
||||
f32
|
||||
|
@ -92,7 +92,7 @@ game_init(Game* self)
|
||||
|
||||
memset(self, '\0', sizeof(Game));
|
||||
|
||||
random_seed_time_set();
|
||||
random_seed_set(0);
|
||||
|
||||
resource_shader_read(&self->resources);
|
||||
|
||||
|
@ -227,6 +227,8 @@ level_init(Level* self, ECS* ecs, LevelSettings settings, u32 levelValue)
|
||||
level_pause_init(self);
|
||||
level_unpause(self);
|
||||
|
||||
random_seed_set(0);
|
||||
|
||||
self->settings = settings;
|
||||
self->medal = LEVEL_MEDAL_NONE;
|
||||
self->nextMedal = LEVEL_MEDAL_BRONZE;
|
||||
|
@ -396,7 +396,7 @@ static const LevelData LEVEL_DATA_DEFAULT[LEVEL_COUNT] =
|
||||
.time = -1
|
||||
},
|
||||
{
|
||||
.status = LEVEL_STATUS_UNLOCKED,
|
||||
.status = LEVEL_STATUS_LOCKED,
|
||||
.score = -1,
|
||||
.time = -1
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user