Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

127
Views
Non-repeating random combined arrays

I need to combine 2 different string arrays to create a name, both with 50 elements. I'll call both arrays A and B. So, the name is A[x] + B[y], X and Y being rng between 1 and 50. But these rng's cant return the same value for the next 9 objects. The object goes like this(acting sort of like a json/api):

const A = {50 different names}
const B = {50 different surnames}

const Data = [{
  firstName: A[Math.floor(Math.random() * (50-1) + 1)],
  secondName: B[Math.floor(Math.random() * (50-1) + 1)],
},
{
  firstName: A[Math.floor(Math.random() * (50-1) + 1)],
  secondName: B[Math.floor(Math.random() * (50-1) + 1)],
}, ...]

It returns the name on a card, and each new object creates a new card.

<h1>{firstName} {secondName}</h1>

As it is now, I get random names, but occasionaly they repeat. Is there any way to fix that?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!