Code example for Random

Methods: nextInt

0
 
    @Override 
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(0xff000000);
        mPaint.setTextSize(mRandom.nextInt(40) + 10);
        mPaint.setColor(0xff000000 + mRandom.nextInt(0x1000000));
        int x = mRandom.nextInt(getWidth()) - (getWidth()/2);
        int y = mRandom.nextInt(getHeight());
        canvas.drawText("abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
                x, y, mPaint);
    } 
}