title: Android - How can I generate a random color with limits?
body: <p>Well, I'm trying to generate a color randomly, but with limits.</p>
  
  <p>By making the RGB colors only between 0 and 49.</p>
  
  <p>It is supposed to make it like this: color.nextInt(50); Right?</p>
  
  <p>This is the code from the activity that draws the squares:</p>
  
  <pre><code>public class Draw extends View 
  {
      public Draw(Context context) 
      {
          super(context);
      }
  
      Paint prop = new Paint();
      Random color = new Random();
  
      @Override
      protected void onDraw(Canvas canvas) 
      {
          super.onDraw(canvas);
  
          int width = getWidth();
          int height = getHeight();
  
          int oriwidth = 0;
          int oriheight = 0;      
  
          for (int x = 0; x &lt; 20; x++) 
          {
              int red = color.nextInt(50);
              int green = color.nextInt(50);
              int blue = color.nextInt(50);
  
              prop.setARGB(0, red, green, blue);
              canvas.drawRect(oriwidth += 10, oriheight += 10, width -= 10, height -= 10, prop);
          }
      }
  }
  </code></pre>
  
  <p>And the result is a full square in white. Without the limit I get it good.</p>
  
  <p>Can you make me get it right to draw a square between a set of values?</p>
  
  <p>Thanks for the help, and sorry for the english.</p>