Skip to content

Commit 4062300

Browse files
committed
Add "this" to 3rd person singular list. Set single digit 40% frequency in --memorable-3 passwords function
1 parent cf62f63 commit 4062300

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

grammarUtils.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ func getPronounAndVerbPresent() string {
130130
// depending on the third-person singular pronoun used.
131131
func appendSIfThirdPerson(verb string, pronoun string) string {
132132

133-
thirdPersonSingularPronouns := []string{"he", "she", "it", "that"}
133+
thirdPersonSingularPronouns := []string{"he", "she", "it", "that", "this"}
134134

135135
for _, p := range thirdPersonSingularPronouns {
136136
if strings.EqualFold(pronoun, p) {

memorablePasswordUtils.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func RandomYearOrInt() string {
4444
// initialize global pseudo random generator
4545
r := rand.New(rand.NewSource(time.Now().UnixNano()))
4646

47-
// Randomly decide between year, int, current year, or double digit
48-
yearOrInt := r.Intn(4)
47+
// Randomly decide between year, int, current year, or double-digit
48+
yearOrInt := r.Intn(5)
4949

5050
minYear := 1900
5151
maxYear := time.Now().Year()
@@ -60,13 +60,14 @@ func RandomYearOrInt() string {
6060
randomYear := r0.Intn(maxYear-minYear+1) + minYear
6161
return strconv.Itoa(randomYear)
6262

63-
} else if yearOrInt == 1 {
63+
// 40% of the time it will return a single digit
64+
} else if yearOrInt == 1 || yearOrInt == 4 {
6465

6566
// initialize global pseudo random generator
6667
r1 := rand.New(rand.NewSource(time.Now().UnixNano()))
6768

68-
// generates a random number between 0 and 99
69-
randomInt := r1.Intn(100)
69+
// generates a random number between 0 and 9
70+
randomInt := r1.Intn(10)
7071

7172
return fmt.Sprintf("%d", randomInt)
7273

@@ -157,7 +158,7 @@ func createMemorable3Password() string {
157158

158159
} else if lexicalChoice == 3 {
159160

160-
// TODO: createPronounVerbPassword()
161+
// TODO: Some other grammatical variation
161162

162163
} else if lexicalChoice == 4 {
163164

passwordgen

0 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)