# How can I randomize colored squares?March 4, 2013 10:11 AM   Subscribe

I'm trying to figure out a way to randomize 324 colored fabric squares. This is a kind of a math question that's technically about sewing.

I would like to, as best as possible, randomize 324 squares (of 14 different colors) for use in making a brighter version of this pixelated quilt (image is a photo from the book I'm using). I'm using different quantities of each color-- ten of the colors will be more represented than the other four (the quilt will be mostly shades of blue/green/turquoise/teal with some shades of yellow interspersed). The finished quilt will be 18 squares across by 18 down.

I'd like to randomize them as much as possible. For example, one idea given to me was to put all the squares in a bag, shake them up, and pull them out one at a time. Great idea, but the problem is that the squares will stick together. Another idea was to assign each color a number and roll dice. Not super-practical with 14 colors.

Adding to the challenge is the method of putting the quilt together. I'll be sewing strips of 6, and when they're all done, sewing all of the strips together. My plan, once I get the strips done, is to pin them up on a wall so that I can move them around to figure out the most attractive configuration before I assemble the final quilt.

So basically, I'd like to randomize them in groups of six. Not sure if that makes sense. Worst case scenario I'll try to just pick random ones from their piles but I'm biased in favor of some of the colors and am pretty sure I'll fall into the trap of overusing the brighter ones and not using enough of the rest of them. Any strategies welcome!
posted by mireille to Sports, Hobbies, & Recreation (15 answers total) 7 users marked this as a favorite

This link to random.org will give you a random list of numbers between 1 and 324. The site has lots of other ways to generate random numbers, look around you'll probably find exactly what you want.
posted by Confess, Fletch at 10:14 AM on March 4, 2013 [1 favorite]

You can make random(ish) numbers in Excel by making cell A1 =ROUNDUP(RAND()*14,0) and filling down -- that will give you a list of random numbers from 1-14. Number your stacks and just grab the next square from that pile. It won't evenly distribute, so you'll run out of one stack before you're out of numbers, but you can just start skipping the numbers of your empty piles.
posted by brainmouse at 10:17 AM on March 4, 2013

They do make 14 sided dice

though I'd just go with excel
posted by bottlebrushtree at 10:18 AM on March 4, 2013

Another link that generates 324 numbers between 1 and 14. Here is the page that generated the numbers.
posted by Confess, Fletch at 10:18 AM on March 4, 2013

If you want to go with the dice metaphor use this, which lets you roll as many dice as you want with as many sides as you want. So roll 324 14-sided dice and you get:

12,1,3,6,7,3,12,2,5,4,7,6,11,11,5,6,13,3,8,8,12,8,10,11,2,4,8,4,14,11,10,3,14,13,12,3,3,1,12,5,
12,14,6,8,7,3,5,14,11,14,7,8,8,9,5,6,12,13,13,9,14,6,14,11,12,1,10,14,13,7,8,13,14,14,3,12,14
,10,5,5,7,10,10,14,7,10,14,7,5,9,8,13,9,10,6,14,9,10,9,9,1,8,1,7,11,6,4,5,7,9,14,8,6,12,11,4,1,
14,8,8,8,1,4,14,10,3,4,14,10,14,6,11,5,12,14,2,12,6,9,4,7,2,14,3,4,8,3,5,9,14,9,12,10,13,1,10,
2,6,4,1,8,1,7,7,8,12,8,11,13,3,1,9,4,7,1,3,8,6,14,13,4,9,5,2,4,13,14,3,9,11,2,2,9,10,4,14,9,12,5
,7,4,12,5,9,9,9,2,3,8,12,12,9,3,2,11,8,11,4,1,3,9,11,2,11,1,13,2,3,6,5,8,11,12,2,12,10,12,12,6,
11,3,2,3,14,12,11,14,1,12,8,3,5,12,6,4,9,9,14,6,7,3,7,12,7,2,8,7,9,10,6,11,14,1,6,9,5,9,13,11,1
3,2,12,7,14,4,5,3,2,8,8,3,1,11,12,12,14,7,5,2,9,4,12,5,5,3,6,4,9,13,3,10,4,13,12,6,2,14,10,4,13
,6,6,6,4,

(You can also roll them 6 dice at a time instead of all 324, or use Excel to split it up.)
posted by griphus at 10:20 AM on March 4, 2013 [1 favorite]

If you want to use a six-sided die to generate a random color (one of 14)

1. Roll the die once. Take the result, subtract 1 and multiply by 3. Write this number down.
2. Roll the die again. Take the result and divide by 2. Round this number up to the nearest whole number. Add this to the first number from Step 1.
3. If the number is greater than 14 (it should be a number between 1 and 18). Redo the procedure until you get a number between 1-14.
posted by vacapinta at 10:26 AM on March 4, 2013

Best answer: I actually just realized that you really don't want random numbers -- you want pseudorandom numbers, which means it will only select from available options. You know exactly how many of each color you have, right? So what you should do in Excel is:

-Make column A a list of all of your squares. So if you have 20 Blue squares, write "blue" in 20 cells in column A, then "green" for 20 cells, then "yellow" for 10 cells, or whatever, until you have each square accurately represented in column A.
-Then in column B, just put =RAND() and fill down.
-Then sort by Column B, and that will randomize column A.

The problem with using real random and skipping numbers once you use up that pile is that you will use up all your colors at the beginning, and end up at the end with 4 purples or whatever, just because that's what's left. Using pseudorandom to randomly sort your available options as above will solve that.
posted by brainmouse at 10:27 AM on March 4, 2013 [10 favorites]

I think brainmouse has your formula, but from a artistic/design perspective I think you'll still have to do a bit of hand tweaking to get something to look more evenly random and harmonious.

Do you have enough space to block it out in its entirety before piecing it into rows? I think this way you'd possibly discover that you need more blocks in a medium value range, or should include fewer of the "variety" colors like the bright yellow or black squares in your example, etc.
posted by fontophilic at 10:36 AM on March 4, 2013 [2 favorites]

Response by poster: Thanks, everyone! I don't have fancy dice but I do have Excel, and I've tried both of brainmouse's solutions. She's got it right on with the second one-- I do know how many of each color I'm going to be using and it looks like the ideal solution. Really thought this one was a shot in the dark but got an answer in under 30 minutes - you guys rock!
posted by mireille at 10:38 AM on March 4, 2013

Some follow ups-- after you do this, delete the cells with the random numbers, the rand() function recalculates any time you do anything and it's obnoxious.

If you want to further group them into sets of 6, you can do this both with #s and with visual cues -- for the numbers, insert a new column A on the left, and put the number 1 in the first 6 cells (I'm assuming A1-A6). Then make A7 =A1+1, and fill down -- that will number your colors in groups of 6. To add borders or whatever, select the first group of 6, and add outside borders to them to make a box around that group. Then select that group of 6, click on the format painter, and then paint down the rest of your 324 cells. If you want to alternate background colors or something, format your first 2 groups how you want, select those 12 cells, and then format painter and then the rest of your cells -- it should follow your formats.

On preview -- glad to see it worked!
posted by brainmouse at 10:40 AM on March 4, 2013

Best answer: If you haven't done too much sewing yet, listen to fontophilic! True randomness doesn't always look like what the eye expectsâ€”it's reasonably likely that there will be a few runs or clusters of the same color squares, which might not be what you want.

It's probably not a big problem on an 18x18 grid, especially since you'll rearrange rows of six, but you might want to test it out first. Here's a quick gdocs spreadsheet that fills in a randomized grid with the colors on the left. If you copy it to your own account, you can recolor or re-randomize the squares from the "Quilt" menu.
posted by ecmendenhall at 2:31 PM on March 4, 2013 [12 favorites]

Response by poster: ecmendenhall -- Did you just make that spreadsheet for me? That's pretty awesome. I've copied it to my account and will play around with that too. I agree with you and fontophilic that the challenge isn't just about randomizing and that it's ultimately about how it appears visually, and that's a pretty amazing tool. Thanks!
posted by mireille at 3:33 PM on March 4, 2013

Here's another option. It's for stripes, but you could run multiple sets of one-color-per-row, 18-rows, 18-times, maybe?

I'm more of a visual person, so the math and spreadsheets wouldn't really help me.
posted by mon-ma-tron at 8:33 PM on March 4, 2013 [1 favorite]

Aww, thanksâ€”it's just a few lines of javascript. I won't let anyone be fooled by randomness!
posted by ecmendenhall at 12:25 AM on March 6, 2013 [2 favorites]

Apologies that this is sort of a not-answer, but why not just pull out of a bag and disentangle them without looking, ending up with only one? Assuming that different colors don't have different stickiness properties for some reason.
posted by threeants at 5:20 PM on March 6, 2013

« Older West Palm Beach relocation help!   |   Training for Urban Ag- Gardening/Farming and... Newer »