Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
9aa1efdf
Commit
9aa1efdf
authored
11 years ago
by
Jean Chalard
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Change how the length of the random words are chosen."
parents
db6984c7
4a1c26ab
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java
+13
-4
13 additions, 4 deletions
...android/inputmethod/latin/makedict/BinaryDictIOTests.java
with
13 additions
and
4 deletions
tests/src/com/android/inputmethod/latin/makedict/BinaryDictIOTests.java
+
13
−
4
View file @
9aa1efdf
...
...
@@ -151,11 +151,20 @@ public class BinaryDictIOTests extends AndroidTestCase {
* Generates a random word.
*/
private
String
generateWord
(
final
Random
random
,
final
int
[]
codePointSet
)
{
StringBuilder
builder
=
new
StringBuilder
(
"a"
);
int
count
=
random
.
nextInt
()
%
30
;
// Arbitrarily 30 chars max
while
(
count
>
0
)
{
StringBuilder
builder
=
new
StringBuilder
();
// 8 * 4 = 32 chars max, but we do it the following way so as to bias the random toward
// longer words. This should be closer to natural language, and more importantly, it will
// exercise the algorithms in dicttool much more.
final
int
count
=
1
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
)
+
(
Math
.
abs
(
random
.
nextInt
())
%
5
);
while
(
builder
.
length
()
<
count
)
{
builder
.
appendCodePoint
(
codePointSet
[
Math
.
abs
(
random
.
nextInt
())
%
codePointSet
.
length
]);
--
count
;
}
return
builder
.
toString
();
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment