aboutsummaryrefslogtreecommitdiff
path: root/passgen/diceware
diff options
context:
space:
mode:
Diffstat (limited to 'passgen/diceware')
-rw-r--r--passgen/diceware/src/main/kotlin/dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator.kt13
1 files changed, 5 insertions, 8 deletions
diff --git a/passgen/diceware/src/main/kotlin/dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator.kt b/passgen/diceware/src/main/kotlin/dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator.kt
index ee18352e..62e3b97b 100644
--- a/passgen/diceware/src/main/kotlin/dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator.kt
+++ b/passgen/diceware/src/main/kotlin/dev/msfjarvis/aps/passgen/diceware/DicewarePassphraseGenerator.kt
@@ -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 {