How do I "assign" a number to cells?

Hi everyone,

I am following the Generative Landscape tutorial to create a “fur pattern” cellular automata output. It’s a really fun tool and I am trying to customize it a little bit. (https://generativelandscapes.wordpress.com/2015/06/19/activator-inhibitor-fur-pattern-example-12-1/)

Essentially on a square grid, the inputs are assigned a 0 or 1 through the Random component. This goes through a CA-like loop, and the result looks like a self-organized fur pattern, still based on whether the cell is 0 or 1.

I have two questions:

Question 1. How can I control how much % of the cells is 0 or 1 at the beginning? I would like to use something like Random Reduce, so that I can control how much % of the grid is 1, but their locations being random.

So far I’ve faked this by using Split List and feeding them into two (or more) Random components, one of which has the range of “0 to 0” and the other “1 to 1.” This does work but I’m curious if there is a better way to do this.

Question 2. This is not relevant to the CA script, but I am curious if there was a way to “assign” more than two numbers to cells on a grid, random or not, so that I can color the grid in multiple ways, much like a cross stitching pattern. I am imagining that this would expand on the method from the 1st question.

I can see using a panel, multiline, and inputting numbers and having them Repeat Data, but I wonder if it could be more intentional than that. Has anyone potentially done this already?

Thank you so very much in advance. I have some grasp of GH but when it comes to the data side of it I still lack a lot of practice.

Best,
Sue

With regards to question 1,
compare the result to the fraction:


You can use multiple comparisons and an “and” or “or” gate to determine their value.