From 7043855e3dc77f793aab53ada2d40d4b6373bf73 Mon Sep 17 00:00:00 2001 From: Dmitry Borisenko <49808844+DmitryBorisenko33@users.noreply.github.com> Date: Wed, 2 Dec 2020 05:05:16 +0300 Subject: [PATCH] randomSeed --- data/set.device.json | 2 +- src/ItemsList.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/data/set.device.json b/data/set.device.json index a8438cc1..3f4cd654 100644 --- a/data/set.device.json +++ b/data/set.device.json @@ -43,7 +43,7 @@ }, { "type": "h4", - "title": "Версия файловой системы: 267" + "title": "Версия файловой системы: 268" }, { "type": "h4", diff --git a/src/ItemsList.cpp b/src/ItemsList.cpp index 290380f2..ee865c2b 100644 --- a/src/ItemsList.cpp +++ b/src/ItemsList.cpp @@ -23,9 +23,12 @@ void itemsListInit() { void addItem(String name) { String item = readFile("items/" + name + ".txt", 1024); - name = deleteToMarkerLast(name, "."); + name = selectToMarker(name, "-"); - item.replace("id", name + "-" + String(getNewElementNumber("id.txt"))); + randomSeed(micros()); + unsigned int num = random(0, 1000); + + item.replace("id", name + String(num)); // "-" + String(getNewElementNumber("id.txt"))); item.replace("order", String(getNewElementNumber("order.txt"))); if (item.indexOf("pin") != -1) { //all cases (random pins from available)