summaryrefslogtreecommitdiffstats
path: root/engine/labelled.cpp
blob: 48e6091b36b81f39aa4799774c24db82941569fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "core/labelled.hpp"

#include <stdlib.h>

using namespace std;
using namespace flat::core;

labelled::labelled(const std::string& label, bool allow_null) 
    : label((!allow_null && label.empty()) ? random_label() : label) {}

string labelled::random_label(uint8_t length) {
    
    string out;

    for (uint8_t i = 0; i < length; ++i)
        out += (char)(rand() % 93 + 33);

    return out;
}