~ruther/qmk_firmware

ref: f3ef90ba902b4cd198b75b1065a01a50ae3d421c qmk_firmware/keyboards/lily58/keymaps/druotoni/fast_random.c -rw-r--r-- 405 bytes
f3ef90ba — mechlovin [Keyboard] Add Shostudio Arc (#21733) 1 year, 9 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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;
}
Do not follow this link