mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-28 12:57:37 +00:00
diceware: switch to buildString
lambda
This commit is contained in:
parent
0830499c6c
commit
95075bd1d0
@ -23,15 +23,12 @@ constructor(
|
||||
|
||||
/** Generates a passphrase with [wordCount] words. */
|
||||
public fun generatePassphrase(wordCount: Int, separator: Char): String {
|
||||
return StringBuilder()
|
||||
.apply {
|
||||
repeat(wordCount) { idx ->
|
||||
append(wordMap[die.rollMultiple(DIGITS)])
|
||||
if (idx < wordCount - 1) append(separator)
|
||||
}
|
||||
return buildString {
|
||||
repeat(wordCount) { idx ->
|
||||
append(wordMap[die.rollMultiple(DIGITS)])
|
||||
if (idx < wordCount - 1) append(separator)
|
||||
}
|
||||
.toString()
|
||||
.trimEnd()
|
||||
}
|
||||
}
|
||||
|
||||
private companion object {
|
||||
|
Loading…
x
Reference in New Issue
Block a user