Gitiles
Code Review
Sign In
source.supwisdom.com
/
dali_platform
/
mobile
/
c43cf97c3449110b612e0954dbe37879e1c8ed63
/
.
/
uview-ui
/
libs
/
function
/
randomArray.js
blob: 590a048036778fa3e3b53851c95a3b8d19c8ea05 [
file
] [
log
] [
blame
]
// 打乱数组
function
randomArray
(
array
=
[])
{
// 原理是sort排序,Math.random()产生0<= x < 1之间的数,会导致x-0.05大于或者小于0
return
array
.
sort
(()
=>
Math
.
random
()
-
0.5
);
}
export
default
randomArray