Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
brianvoe committed Oct 26, 2024
2 parents 59e0c2a + f3c8f7b commit 70cb028
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions product.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,20 @@ func ProductAudience() []string { return productAudience(GlobalFaker) }
func (f *Faker) ProductAudience() []string { return productAudience(f) }

func productAudience(f *Faker) []string {
targetAudiences := []string{}
audiences := []string{}
for i := 0; i < number(f, 1, 2); i++ {
targetAudiences = append(targetAudiences, getRandValue(f, []string{"product", "target_audience"}))
// Check if the target audience is already in the list
// If it is, generate a new target audience
for {
audience := getRandValue(f, []string{"product", "target_audience"})
// Check if in array
if !stringInSlice(audience, audiences) {
audiences = append(audiences, audience)
break
}
}
}
return targetAudiences
return audiences
}

// ProductDimension will generate a random product dimension
Expand Down

0 comments on commit 70cb028

Please sign in to comment.