2021-11-22 19:50:54 +00:00
|
|
|
package arbitrary
|
|
|
|
|
2021-11-22 23:40:19 +00:00
|
|
|
import (
|
|
|
|
"strings"
|
|
|
|
)
|
2021-11-22 19:50:54 +00:00
|
|
|
|
|
|
|
// Password returns an arbitrary password.
|
|
|
|
func (arb T) Password() string {
|
|
|
|
|
|
|
|
var result string
|
|
|
|
{
|
|
|
|
result = passwords[arb.randomness.Intn(len(passwords))]
|
|
|
|
}
|
|
|
|
|
2021-11-22 23:40:19 +00:00
|
|
|
if 0 == arb.randomness.Intn(7) {
|
|
|
|
|
|
|
|
var storage strings.Builder
|
|
|
|
|
|
|
|
var limit int = 2 + arb.randomness.Intn(6)
|
|
|
|
|
|
|
|
for i:=0; i<limit; i++ {
|
|
|
|
if 0 != i {
|
|
|
|
storage.WriteRune(' ')
|
|
|
|
}
|
|
|
|
|
|
|
|
var s string = words[arb.randomness.Intn(len(words))]
|
|
|
|
|
|
|
|
storage.WriteString(s)
|
|
|
|
}
|
|
|
|
|
|
|
|
result = storage.String()
|
|
|
|
}
|
|
|
|
|
2021-11-22 19:50:54 +00:00
|
|
|
if 0 == arb.randomness.Intn(97) {
|
|
|
|
result = arb.String()
|
|
|
|
}
|
|
|
|
|
|
|
|
return result
|
|
|
|
}
|