Skip to content

Instantly share code, notes, and snippets.

@X39
Last active March 19, 2016 19:52
Show Gist options
  • Save X39/903e512c3bd865e3736b to your computer and use it in GitHub Desktop.
Save X39/903e512c3bd865e3736b to your computer and use it in GitHub Desktop.
X39_fnc_genMissionUUID = {
///Generates a numbers only UUID
///Chance for duplicates is extremly low but not 100% terminated!
///Chance for duplicates can be further reduced by taking player
///UID into account (will prevent usage for servers)
private [
"_fnc_toNDigitsStringRandom",
"_parts"
];
_fnc_toNDigitsStringRandom = {
params [
["_num", nil, 0],
["_len", nil, 0]
];
private ["_n", "_arr"];
_num = _num + random _len;
_num = str ceil (_num mod _len);
_num = toArray _num;
_n = count _num
_arr = [];
for "_i" from 0 to _n do
{
_arr pushBack 48 + floor random 9; //'0'
};
_arr pushBack _num;
toString _arr
}
_parts = [];
_parts pushBack ([diag_tickTime, 1000] call _fnc_toNDigitsStringRandom);
_parts pushBack ([random 20000, 1000] call _fnc_toNDigitsStringRandom);
_parts pushBack ([diag_fps, 1000] call _fnc_toNDigitsStringRandom);
_parts pushBack ([random 20000, 1000] call _fnc_toNDigitsStringRandom);
_parts pushBack ([diag_frameNo, 1000] call _fnc_toNDigitsStringRandom);
_parts pushBack ([random 20000, 1000] call _fnc_toNDigitsStringRandom);
format["{%1}", _parts joinString "-"]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment