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

106
Vistas
Do While Loop exits despite condition being met

I have the following code (where generateGaussian is a function previously defined elsewhere):

function varInstance(stdev, scaling, shift){
gg = -999;
 do {
    gg = generateGaussian(0, stdev);
 }
 while (-3 > gg > 3);
 return ((gg * scaling) + shift);
}

What I want it to do is to produce a value between -3 and +3 But I notice that occasionally it gives me values >3. I have not not noticed it giving me values <-3, though. What am I doing wrong and how can I change it to limit the output to the -3...3 range?

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