Hidden Photoshop Script EASILY Generates Random Fills!
Your choices stick across every tutorial on this device.
Random Fill in Photoshop uses a hidden script inside the Fill dialog to scatter copies of a custom pattern across a layer, each one randomly scaled, rotated, and colored.
Sometimes Photoshop’s pattern presets do not fit your photo composite, but we have a solution for you!
In this tutorial, you will discover this hidden Photoshop script that will allow you to generate a random fill from a pattern and create your own.
Key Takeaways
- A hidden script in the Fill dialog called Random Fill scatters copies of a pattern instead of tiling them in a fixed grid.
- You have to Define Pattern from your own layer first. Random Fill only scatters a pattern preset that already exists.
- Color randomness and Brightness randomness are separate sliders. Set color randomness to 0 to keep every copy the same color while brightness still varies.
- The Rotate Pattern option is what makes the scatter look natural. Without it, every copy lands at the same angle.
- Running Random Fill a second time on a new layer, with a lower density and a smaller scale, adds depth instead of just piling on more copies.
- Copying a Drop Shadow layer style onto a new layer needs Alt (Windows) or Option (macOS) held while you drag the fx icon. Dragging it without that key moves the effect instead of copying it.
Table of contents
- What You Will Learn
- Requirements
- Random Fill in Photoshop Keyboard Shortcuts
- Tutorial Image
- Remove Background Using Select Subject
- Convert the Dollar Bill Into a Pattern
- Generate the Fill with the Random Pattern Fill Script
- Power Tip for More Realistic Results!
- Frequently Asked Questions
- Conclusion
- Related Links
What You Will Learn
- How to remove a background with Select Subject and clean up the mask with the Select and Mask workspace.
- How to turn any layer into a custom pattern with Define Pattern.
- How to scatter that pattern randomly with the Random Fill script in the Fill dialog.
- How to control the scale, rotation, color, and density of the scatter.
- How to stack a second randomized layer and a Drop Shadow to add depth.
Requirements
Before you start
- Photoshop 2020 (version 21.2 or later) or the current version
Random Fill in Photoshop Keyboard Shortcuts
| Action | Windows | macOS |
|---|---|---|
| Open the Fill dialog box | Shift Backspace | Shift Delete |
| Draw a straight line with the Brush Tool (click, then Shift-click again) | Shift | Shift |
| Copy a layer style to another layer (drag the fx icon) | Alt | Option |
Tutorial Image
To follow along the tutorial, download the image here.
Remove Background Using Select Subject
Start by extracting the Dollar bill from its background. Photoshop’s built-in artificial intelligence (AI) makes creating a selection more straightforward.
To do that, choose Select > Subject.
If the AI misses out a part of the object you want to select, you may use the Quick Selection tool to add to the selection. You may also use it to subtract from the selection.

With the selection active, click on the layer mask icon to create a layer mask based on the selection.
If need be, you can use the Brush Tool and paint on the mask with black (#000000) to hide pixels or paint with white (#ffffff) to reveal. You may also use the Select and Mask Workspace to refine the mask edges.
Convert the Dollar Bill Into a Pattern
Select the Rectangular Marquee tool from the Toolbar.
Then, make a selection a little larger than the dollar bill.

Select the Layer thumbnail, not the Layer Mask thumbnail.

Choose Edit > Define Pattern. Name for your new pattern preset.

Create a New Layer and disable the original layer.

Generate the Fill with the Random Pattern Fill Script
Bring up the Fill dialog box by pressing ShiftBackspace (Windows) or ShiftDelete (macOS).
On the Fill dialog box, set the Contents to Pattern.

As the Options appear, set the Custom Pattern to the Dollar Bill pattern preset you just created, which you may also find at the very bottom of the list.
Check the box for Script and on the drop-down menu beside it, select Random Fill.

Then, press OK.
The previous step brings out the Random Fill dialog box with several options available.
Start with Color randomness and Brightness randomness.

The Color randomness determines the variety of colors that will apply in the pattern. Meanwhile, the Brightness randomness applies a different range of brightness among the patterns.
If you want to set the pattern with the same color, then adjust the Color randomness to 0.

You can also set the Brightness randomness to 0.2 for a slight difference in brightness.

Then, check the box for Rotate pattern, so the pattern rotates randomly.

Increase the Density to its maximum at 10 pixels.

By setting the Minimum scale factor and the Maximum scale factor to 1 the resulting generated dollar bills will be the same size as the original.

Then, press OK.
Upon exiting, you’ll see how your working document is now filled with the Dollar bill pattern!
Power Tip for More Realistic Results!
Start by creating a New Layer.
Once again, bring out the Fill dialog box by pressing ShiftBackspace (Windows) or ShiftDelete (macOS).

Then, press OK.
The Random Fill window will remember the previous settings.
Start by setting the Minimum scale factor and the Maximum scale factor to .25 as this sets the Dollar bill to 25% of the original size.

Also, set the Density to 9 pixels, to leave gaps in the fill.

Then, press OK.
NOTE: If you can’t see the transparency checkerboard, you might need to disable the previous layers to see its full effect.
Double-click on the New Layer’s side to bring out the Layer Style window and click on the Drop Shadow style.

You can edit the Structure and the Quality of the Drop Shadow style to achieve realism according to your preference. But it’s also good enough to use the default settings. Then, press OK to see it in effect.
Create another New Layer and repeat the process of bringing up the Fill window by pressing ShiftBackspace (Windows) or ShiftDelete (macOS), and press OK.
When the Random Fill window pops up, it will remember the previous settings you applied and press OK. This will apply a new random fill layer of the dollar bill pattern, which helps create depth.

To apply the same Layer Style with the Drop Shadow in the previous layer, hold Alt (Windows) or Option (macOS) and click-and-drag the fx icon over to the New Layer. Drop it there.

And here’s the final result when you keep repeating the process. Once you have a realistic bed of Dollar bills, use it for a photo composite or a poster project!

Frequently Asked Questions
Random Fill in Photoshop is a script inside the Fill dialog that scatters copies of a pattern across a layer. Each copy gets its own random scale, rotation, color, and spacing, so the result does not look like a repeating tile.
Open the Fill dialog and set Contents to Pattern. Check the Script box, then choose Random Fill from the dropdown next to it.
Yes. Select the area you want to repeat with the Rectangular Marquee tool, then choose Edit > Define Pattern. Random Fill can only scatter a pattern that already exists as a preset.
Color randomness shifts the hue of each copy. Brightness randomness only varies how light or dark each copy looks. Set Color randomness to 0 to keep every copy the same color.
Every copy lands at the same angle unless you check Rotate Pattern. Running Random Fill a second time on a new layer, with a lower Density and a smaller scale, also adds depth.
Hold Alt (Windows) or Option (macOS) while you drag the fx icon from one layer onto another. Dragging without that key moves the effect instead of copying it.
No. The dollar bill in this tutorial is a low-resolution, JPEG-compressed stock photo, which is why its serial number is not readable. Do not use this technique on a real, legible bill.
Conclusion
Random Fill in Photoshop turns one pattern into a natural-looking scatter of copies, each with its own random scale, rotation, color, and spacing.
Stack a second, sparser layer and copy the Drop Shadow with Alt (Windows) or Option (macOS) held for a result with real depth.
Comment on the video with any question.
Selections and Masking Mastery
Complete course includes 2.5 hours of step-by-step lessons, 6 structured modules, downloadable practice files, and custom Photoshop brushes. Everything you need to master selections and masks in one place.
Keep going
This scatter technique is just the raw material. Next, make the rest of your composite look just as realistic.
Related Links
Final Image
Drag the slider to see before and after









