mirror of
https://github.com/android-password-store/Android-Password-Store.git
synced 2026-04-11 00:41:10 +02: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…
Reference in a new issue