2021-07-25 14:34:54 +03:00
|
|
|
#include "random_name.h"
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <furi.h>
|
|
|
|
|
|
|
|
void set_random_name(char* name, uint8_t max_name_size) {
|
2022-06-26 20:57:29 +03:00
|
|
|
static bool rand_generator_inited = false;
|
|
|
|
|
|
|
|
if(!rand_generator_inited) {
|
|
|
|
srand(DWT->CYCCNT);
|
|
|
|
rand_generator_inited = true;
|
|
|
|
}
|
|
|
|
const char* prefix[] = {
|
|
|
|
"super",
|
|
|
|
"big",
|
|
|
|
"little",
|
|
|
|
"liquid",
|
|
|
|
"unknown",
|
|
|
|
"thin",
|
|
|
|
"thick",
|
|
|
|
"great",
|
|
|
|
"my",
|
|
|
|
};
|
|
|
|
|
|
|
|
const char* suffix[] = {
|
|
|
|
"maslina",
|
|
|
|
"sus",
|
|
|
|
"anomalija",
|
|
|
|
"artefact",
|
|
|
|
"monolit",
|
|
|
|
"burer",
|
|
|
|
"sidorovich",
|
|
|
|
"habar",
|
|
|
|
};
|
|
|
|
// sus is not (sus)pect - this is about super sus
|
|
|
|
uint8_t prefix_i = rand() % COUNT_OF(prefix);
|
|
|
|
uint8_t suffix_i = rand() % COUNT_OF(suffix);
|
|
|
|
|
|
|
|
sniprintf(name, max_name_size, "%s_%s", prefix[prefix_i], suffix[suffix_i]);
|
|
|
|
// Set first symbol to upper case
|
|
|
|
name[0] = name[0] - 0x20;
|
|
|
|
}
|