setStrokeランダムな太さの線を使用しBasicStrokeて描画しようとしています。
ペイントコードはこちら
 public void paintComponent(Graphics g1) {
        Random rand = new Random();
        Graphics g2 = (Graphics2D) g1;
        //set background color
        g2.setColor(Color.white);
        g2.fillRect(0, 0, getWidth(), getHeight());
        Dimension d = getPreferredSize();
        //set  line's color
        float r = rand.nextFloat();
        float g = rand.nextFloat();
        float b = rand.nextFloat();
        Color randomColor = new Color(r,g,b);
        g2.setColor(randomColor);
        //set line's stroke
        float width = rand.nextFloat();
        BasicStroke randomStroke = new BasicStroke(width);
        ((Graphics2D) g2).setStroke(randomStroke);
        for (Line2D.Double line : lines) {
            g2.drawLine(
                (int)line.getX1(),
                (int)line.getY1(),
                (int)line.getX2(),
                (int)line.getY2()
                );
        }
    }
ストロークの幅を特定の数値に設定すると、正しく描画できます。クラスを調べたところBasicStroke、次のパラメーターがあります。
  float width;
  int join;
  int cap;
  float miterlimit;
  float[] dash;
  float dash_phase;
幅の他に、他の機能が何であるかわかりません。BasicStrokeを使用してランダムな太さの線を生成するにはどうすればよいですか?