Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6da97dd

Browse files
authored
Swap the two using es6 deconstruction
1 parent099d4ba commit6da97dd

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

‎src/shuffle/fisheryates.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,9 @@
2020
functionshuffle(array){
2121
varsize=array.length;
2222
varrand;
23-
vartemp;
2423
for(vari=0;i<size;i+=1){
2524
rand=Math.floor(i+Math.random()*(size-i));
26-
temp=array[rand];
27-
array[rand]=array[i];
28-
array[i]=temp;
25+
[array[rand],array[i]]=[array[i],array[rand]];
2926
}
3027
returnarray;
3128
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp