Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
ipgallery
/
devops
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Registry
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
030d176e
authored
Nov 29, 2017
by
amir
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
randomize strings
parent
68b82007
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
1 deletions
tools/wsEventEmulator/app.js
tools/wsEventEmulator/app.js
View file @
030d176e
...
@@ -52,6 +52,10 @@ function randomIntBetween(minValue,maxValue){
...
@@ -52,6 +52,10 @@ function randomIntBetween(minValue,maxValue){
return
parseInt
(
Math
.
min
(
minValue
+
(
Math
.
random
()
*
(
maxValue
-
minValue
)),
maxValue
));
return
parseInt
(
Math
.
min
(
minValue
+
(
Math
.
random
()
*
(
maxValue
-
minValue
)),
maxValue
));
}
}
function
randomStringBetween
(
values
){
return
values
[
parseInt
(
Math
.
random
()
*
values
.
length
)]
}
function
handleChild
(
child
,
parent
)
{
function
handleChild
(
child
,
parent
)
{
var
obj
=
parent
[
child
];
var
obj
=
parent
[
child
];
switch
(
typeof
obj
){
switch
(
typeof
obj
){
...
@@ -60,7 +64,7 @@ function handleChild(child, parent) {
...
@@ -60,7 +64,7 @@ function handleChild(child, parent) {
break
;
break
;
case
'string'
:
case
'string'
:
var
args
=
obj
.
split
(
":"
);
var
args
=
obj
.
split
(
":"
);
if
(
args
.
length
=
=
4
){
if
(
args
.
length
>
=
4
){
if
(
args
[
0
]
==
'R'
){
if
(
args
[
0
]
==
'R'
){
var
startRange
=
args
[
2
];
var
startRange
=
args
[
2
];
var
endRange
=
args
[
3
];
var
endRange
=
args
[
3
];
...
@@ -72,6 +76,9 @@ function handleChild(child, parent) {
...
@@ -72,6 +76,9 @@ function handleChild(child, parent) {
case
'F'
:
case
'F'
:
parent
[
child
]
=
randomFloatBetween
(
startRange
,
endRange
);
parent
[
child
]
=
randomFloatBetween
(
startRange
,
endRange
);
break
;
break
;
case
'S'
:
parent
[
child
]
=
randomStringBetween
(
args
.
slice
(
2
,
args
.
length
));
break
;
}
}
}
}
}
}
...
...
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