diff options
author | druotoni <89318351+druotoni@users.noreply.github.com> | 2022-01-13 20:00:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-13 11:00:35 -0800 |
commit | b3c0548ed3cdb31c47d1a9e06c446c0804d6e1b6 (patch) | |
tree | 87ba1062ffd5d3c77e7ea95fe537d32c3337da94 /keyboards/lily58/keymaps/druotoni/fast_random.c | |
parent | 8a6da095d22d66c0ba36ce8731c9d821ca4262e9 (diff) |
[Keymap] Lily58 : HELL0 NAVI. Interface (#15469)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'keyboards/lily58/keymaps/druotoni/fast_random.c')
-rw-r--r-- | keyboards/lily58/keymaps/druotoni/fast_random.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/keyboards/lily58/keymaps/druotoni/fast_random.c b/keyboards/lily58/keymaps/druotoni/fast_random.c new file mode 100644 index 0000000000..3028b57ac6 --- /dev/null +++ b/keyboards/lily58/keymaps/druotoni/fast_random.c @@ -0,0 +1,17 @@ +// Copyright 2021 Nicolas Druoton (druotoni) +// SPDX-License-Identifier: GPL-2.0-or-later +#include "fast_random.h" + +// seed for random +static unsigned long g_seed = 0; + +int fastrand(void) { + // todo : try with random16(); + g_seed = (214013 * g_seed + 2531011); + return (g_seed >> 16) & 0x7FFF; +} + +unsigned long fastrand_long(void) { + g_seed = (214013 * g_seed + 2531011); + return g_seed; +} |