Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
cc4588e6
Commit
cc4588e6
authored
Jan 31, 2021
by
Valentin Platzgummer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MeasurementArea.cc better randmomId
parent
a4d09405
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
8 deletions
+19
-8
MeasurementArea.cc
src/MeasurementComplexItem/geometry/MeasurementArea.cc
+19
-8
No files found.
src/MeasurementComplexItem/geometry/MeasurementArea.cc
View file @
cc4588e6
...
...
@@ -19,7 +19,7 @@
#define MAX_TILES 1000
#endif
QString
randomId
();
QString
randomId
(
std
::
size_t
length
=
10
);
using
namespace
geometry
;
namespace
trans
=
bg
::
strategy
::
transform
;
...
...
@@ -726,13 +726,24 @@ bool getTiles(const FPolygon &area, Length tileHeight, Length tileWidth,
return
true
;
}
QString
randomId
()
{
std
::
srand
(
std
::
time
(
nullptr
));
std
::
int64_t
r
=
0
;
QString
randomId
(
std
::
size_t
length
)
{
static
const
QString
values
(
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
);
static
std
::
uint64_t
counter
=
0
;
static
auto
firstCall
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
delta
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
nanoseconds
>
(
std
::
chrono
::
high_resolution_clock
::
now
()
-
firstCall
)
.
count
();
for
(
int
i
=
0
;
i
<
10
;
++
i
)
{
r
^=
std
::
rand
();
std
::
srand
((
unsigned
int
)
delta
^
counter
);
QString
str
;
for
(
int
i
=
0
;
i
<
length
;
++
i
)
{
int
index
=
std
::
rand
()
%
values
.
length
();
QChar
c
=
values
.
at
(
index
);
str
.
append
(
c
);
}
return
QString
::
number
(
r
);
++
counter
;
return
str
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment