Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
How to check randomly generated values contained in the variables are not listed in same manner for 10,000 times

I have a java function where I am writing following parameters randomly to a .json file

 const extraMetadata = () => ([
  {
    display_type: "boost_number",
    trait_type: "Stamina",
    value: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "Strength",
    value: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "Aggressiveness",
    value: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "IQ",
    vvalue: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "Bravery",
    value: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "Nerdy",
    value: Math.floor(Math.random() * 50),
  },
  {
    display_type: "boost_number",
    trait_type: "Coolness",
    value: Math.floor(Math.random() * 50),
  },
]);

I am printing these variable like 10,000 times in 10,000 .json files. Where each file will have below values printed randomly.

Results inside the .json file

How can I make sure these entire parameters are not printed the exact same way.

If one of the .json file contains below values then I don't want the next randomly generated .json file to contain the same values for parameters. In that case, if same values are found in the parameters then regenerate next random number until no matches are found.

In other words, i dont want any .json to contain exact same values for all variables

  "trait_type": "Stamina",
  "value": 19

  "trait_type": "Strength",
  "value": 47

  "trait_type": "Aggressiveness",
  "value": 35

  "trait_type": "IQ",
  "vvalue": 33


 "trait_type": "Bravery",
      "value": 23
 
"trait_type": "Nerdy",
      "value": 13
    
"trait_type": "Coolness",
      "value": 12

Below is the line which pushes the values to single .json file

  attributes: [...attributesList, ...extraMetadata(),],
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda