Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
chinaamc-2020flag
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
965173ed
authored
Jan 08, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
245d4944
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
0 deletions
+12
-0
Public/static/js/common.js
+12
-0
No files found.
Public/static/js/common.js
View file @
965173ed
...
...
@@ -487,4 +487,15 @@ function RandomNumBoth(Min, Max) {
var
Rand
=
Math
.
random
();
var
num
=
Min
+
Math
.
round
(
Rand
*
Range
);
//四舍五入
return
num
;
}
/**
* 数组元素交换位置
* @param {array} arr 数组
* @param {number} index1 添加项目的位置
* @param {number} index2 删除项目的位置
* index1和index2分别是两个数组的索引值,即是两个要交换元素位置的索引值,如1,5就是数组中下标为1和5的两个元素交换位置
*/
function
swapArray
(
arr
,
index1
,
index2
)
{
arr
[
index1
]
=
arr
.
splice
(
index2
,
1
,
arr
[
index1
])[
0
];
return
arr
;
}
\ No newline at end of file
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