code: private void drawLine(BufferedImage image) {
          Random r = new Random();
          Graphics2D g2 = (Graphics2D) image.getGraphics();
          int max = this.textLength * this.linePower;
          for (int i = 0; i < max; i++) {
              int x1 = r.nextInt(w);
              int y1 = r.nextInt(h);
              int x2 = r.nextInt(w);
              int y2 = r.nextInt(h);
              g2.setStroke(new BasicStroke(1.5F));
              g2.setColor(this.randomColor());
              g2.drawLine(x1, y1, x2, y2);
          }
          g2.dispose();
      }
docs: 随机像图片中画短直线
  
  @param image 被画直线的图片