summaryrefslogtreecommitdiff
path: root/Demos/Fire
diff options
context:
space:
mode:
authorBrendan Coles <bcoles@gmail.com>2020-04-28 00:17:31 +0000
committerAndreas Kling <kling@serenityos.org>2020-04-28 09:30:01 +0200
commitc4d3723087e05fc57fb1d415152c146a51115bea (patch)
tree486820ea2122cfadb1af9e8aadc5d1c40a462ca7 /Demos/Fire
parent23ec578a016d5d8b4e55553924d3d37d899854c8 (diff)
downloadserenity-c4d3723087e05fc57fb1d415152c146a51115bea.zip
Fire: Use LibC srand()
Diffstat (limited to 'Demos/Fire')
-rw-r--r--Demos/Fire/Fire.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/Demos/Fire/Fire.cpp b/Demos/Fire/Fire.cpp
index cf58f8affe..cc566408c6 100644
--- a/Demos/Fire/Fire.cpp
+++ b/Demos/Fire/Fire.cpp
@@ -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];