summaryrefslogtreecommitdiffstats
path: root/engine/labelled.cpp
blob: e39686ca1337c344905cb4debcd93b4ef8e0c6c4 (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;
}