random_name.c 1007 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "random_name.h"
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <stdbool.h>
  5. #include <furi.h>
  6. void set_random_name(char* name, uint8_t max_name_size) {
  7. const char* prefix[] = {
  8. "ancient", "hollow", "strange", "disappeared", "unknown",
  9. "unthinkable", "unnamable", "nameless", "my", "concealed",
  10. "forgotten", "hidden", "mysterious", "obscure", "random",
  11. "remote", "uncharted", "undefined", "untravelled", "untold",
  12. };
  13. const char* suffix[] = {
  14. "door",
  15. "entrance",
  16. "doorway",
  17. "entry",
  18. "portal",
  19. "entree",
  20. "opening",
  21. "crack",
  22. "access",
  23. "corridor",
  24. "passage",
  25. "port",
  26. };
  27. uint8_t prefix_i = rand() % COUNT_OF(prefix);
  28. uint8_t suffix_i = rand() % COUNT_OF(suffix);
  29. snprintf(name, max_name_size, "%s_%s", prefix[prefix_i], suffix[suffix_i]);
  30. // Set first symbol to upper case
  31. name[0] = name[0] - 0x20;
  32. }