All kinds of rectangles can be created using the rectangle tool in Photoshop such as thin ones, squares, wide rectangles and many others. You can use
Tutorial by: Andrew Buckle
Works with: Photoshop CC and CS and standalone, Elements
Other tutorials: Tutorial links
Videos: Video tutorials
the rectangle tool (press U on the keyboard) once or multiple times to create all kinds of unique artworks. To use them as a source for a pattern and in particular one for the random fill script, it is best to add the rectangle or more onto a layer (or layers). You can use them with a single color or gradient or a pattern as well, along with a stroke. You can also combine that layer with a layer effect such as a shadow or you can convert it into a smart object and combine with effects such as paint daubs and blurs. The key thing though for the random fill or pattern scripts in Photoshop is to remove the background so just go to the layer panel and delete the background leaving only the rectangles as this means the random fill will not be filled with a white background (if white).
Go to the rectangular marquee tool in the PS toolbox and then select the shape. Go to the edit menu and define command. It is now stored in the panel and can be used with all the other tiles.
Go to the edit menu and fill command and select the pattern option and then select the script checkbox - set the dropdown to random fill (or any of the others) and select the correct rectangular tile. Click OK. A dialog will appear allowing you to modify the density as well as scale and rotation and color and brightness etc. Depending on the size of the document / tile, the preview will loosely represent the end result (not really sure if the preview is actually showing a part of the result or it is just occasionally inaccurate). Anyway, you will see a jumble of lines filling the preview and you can increase or remove lines by changing the density. You can always apply the fill and then add a new layer and then add another random fill to totally fill the image. You can also then use multiple layers and adjustment layers to create a randomly colored jumble of lines.
You can also use the end result as a source for a background for a new line shape. Just make the source tile really large and fill that with the lines and then define that via the edit menu. Go to the rectangle tool again and create a new shape layer and set the fill not to a solid color but to a pattern. And then repeat the process