mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
Fire: Use LibC srand()
This commit is contained in:
parent
23ec578a01
commit
c4d3723087
Notes:
sideshowbarker
2024-07-19 07:14:49 +09:00
Author: https://github.com/bcoles Commit: https://github.com/SerenityOS/serenity/commit/c4d3723087e Pull-request: https://github.com/SerenityOS/serenity/pull/1994
1 changed files with 2 additions and 18 deletions
|
@ -70,22 +70,6 @@ static const Color s_palette[] = {
|
|||
Color(0xCF, 0xCF, 0x6F), Color(0xEF, 0xEF, 0xC7), Color(0xFF, 0xFF, 0xFF)
|
||||
};
|
||||
|
||||
/* Random functions...
|
||||
* These are from musl libc's prng/rand.c
|
||||
*/
|
||||
static uint64_t seed;
|
||||
|
||||
void my_srand(unsigned s)
|
||||
{
|
||||
seed = s - 1;
|
||||
}
|
||||
|
||||
static int my_rand(void)
|
||||
{
|
||||
seed = 6364136223846793005ULL * seed + 1;
|
||||
return seed >> 33;
|
||||
}
|
||||
|
||||
/*
|
||||
* Fire Widget
|
||||
*/
|
||||
|
@ -129,7 +113,7 @@ Fire::Fire()
|
|||
cycles = 0;
|
||||
phase = 0;
|
||||
|
||||
my_srand(time(nullptr));
|
||||
srand(time(nullptr));
|
||||
stop_timer();
|
||||
start_timer(20);
|
||||
|
||||
|
@ -170,7 +154,7 @@ void Fire::timer_event(Core::TimerEvent&)
|
|||
/* Paint our palettized buffer to screen */
|
||||
for (int px = 0 + phase; px < FIRE_WIDTH; px += 2) {
|
||||
for (int py = 1; py < 200; py++) {
|
||||
int rnd = my_rand() % 3;
|
||||
int rnd = rand() % 3;
|
||||
|
||||
/* Calculate new pixel value, don't go below 0 */
|
||||
u8 nv = bitmap->bits(py)[px];
|
||||
|
|
Loading…
Add table
Reference in a new issue