Hint

Refer to QMK’s documentation for details on how to use community modules

rng

Generate (pseudo-)random numbers.

Note

This is just a convenience layer on top of lib8tion.h right now, but may use another source in the future.

void rng_set_seed(uint16_t seed)
[source]

Set the seed for the RNG. eg: invoking it from keyboard_post_init_user before consuming RNG.

Tip

You can for example call this:
  • The reading on a floating ADC pin

  • The value on some uninitialized memory address (only good entropy on cold start)

Warning

Setting a constant value means the PRNG sequence will be the same on every restart.

uint16_t rng_min_max(uint16_t min, uint16_t max)
[source]

Generate a random number in the [min, max] range.

It will also add some entropy to the RNG.