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?