mirror of
https://github.com/IoTManagerProject/IoTManagerWeb.git
synced 2026-03-26 23:12:34 +03:00
случайные id
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
if (itemsJsonBind === item.num) {
|
||||
delete item.num;
|
||||
delete item.name;
|
||||
item.id = item.id + randomInteger(0, 100);
|
||||
configJson.push(item);
|
||||
configJson = configJson;
|
||||
itemsJsonBind = 0;
|
||||
@@ -34,6 +35,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
function randomInteger(min, max) {
|
||||
// получить случайное число от (min-0.5) до (max+0.5)
|
||||
let rand = min - 0.5 + Math.random() * (max - min + 1);
|
||||
return Math.round(rand);
|
||||
}
|
||||
|
||||
function deleteLineFromConfig(num) {
|
||||
for (let i = 0; i < configJson.length; i++) {
|
||||
if (num === i) {
|
||||
|
||||
Reference in New Issue
Block a user