Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Y
YGOMobile-Cn-Ko-En
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fallenstardust
YGOMobile-Cn-Ko-En
Commits
53516148
Commit
53516148
authored
Nov 06, 2024
by
fallenstardust
Committed by
GitHub
Nov 06, 2024
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #170 from CaoRX/fix-unSort
fix: use random shuffle for unSort
parents
385bebc2
0f78ddca
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
10 deletions
+3
-10
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
.../java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
+3
-10
No files found.
mobile/src/main/java/cn/garymb/ygomobile/ui/cards/deck/DeckAdapater.java
View file @
53516148
...
...
@@ -141,16 +141,9 @@ public class DeckAdapater extends RecyclerView.Adapter<DeckViewHolder> implement
public
void
unSort
()
{
if
(
mMainCount
==
0
)
return
;
for
(
int
i
=
0
;
i
<
Constants
.
UNSORT_TIMES
;
i
++)
{
int
index1
=
mRandom
.
nextInt
(
mMainCount
);
int
index2
=
mRandom
.
nextInt
(
mMainCount
);
if
(
index1
!=
index2
)
{
int
sp
=
(
mMainCount
-
Math
.
max
(
index1
,
index2
));
int
count
=
sp
>
1
?
mRandom
.
nextInt
(
sp
-
1
)
:
1
;
for
(
int
j
=
0
;
j
<
count
;
j
++)
{
Collections
.
swap
(
mItems
,
DeckItem
.
MainStart
+
index1
+
j
,
DeckItem
.
MainStart
+
index2
+
j
);
}
}
for
(
int
i
=
0
;
i
<
mMainCount
;
i
++)
{
int
index
=
mRandom
.
nextInt
(
mMainCount
-
i
);
Collections
.
swap
(
mItems
,
DeckItem
.
MainStart
+
i
,
DeckItem
.
MainStart
+
i
+
index
);
}
notifyItemRangeChanged
(
DeckItem
.
MainStart
,
DeckItem
.
MainStart
+
getMainCount
());
}
...
...
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