Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

234
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda