# Output values within a domain along graph/frequency curve?

Hi… Hopefully I am describing this correctly. Instead of a true random, is there a way to output values that respond to different graphs/curves? The logic I am thinking is:

Input: domain(range R) and number of values N.
Component: Use graph to set frequency curve (?)
Output: N number of values within R range, but frequency of values correspond to the curve.

Example: I want to simulate a city and have buildings extruded in random heights.
But true random wouldn’t look right- as there may be 0.0 height and 1.0 height all too frequently.
Instead, if the trend of building heights was like a bell curve (most building heights are around (0.5), then more buildings would be around that height .

Skyline comparison… Existing:

True random- looks way too fake!

Does that make sense? Is this possible in GH? I am not looking for attractor points/curves as I want this version to NOT be geographically related. (that is one module I will get to…)

Any ideas?? Thank you!!

As an offering I am attaching the script that I’ve created. make random buildings from a ground surface.gh (13.4 KB)

Here’s an attempt. It first of all assumes the GH random is uniform (not a good assumption…) and maps those random values from 0 to 1 into something like a bell curve, so if you input a uniform value, it has a greater chance of being towards the center. I also show the resulting histogram, and there’s a parameter you can play with to adjust the distribution.

That said, your def, which I didn’t want to touch, doesn’t result in many buildings. You said “city”, so maybe you’re planning for more. My def “looks” best when there are a lot of values.

Uniform to sort of Gaussian.gh (18.6 KB)

Using attractor points was the first approach that occurred to me, are you sure it isn’t adaptable?

You didn’t internalize your “input surface(s)”.

Thanks Ethan and Joseph. The start of my script is to divide surface(s) into grids, so any surface input (or multiples or) would work. The model I am using right now has multiple surfaces (representing blocks), so inputting all of them and giving them a grid makes a diagrammatic city.

It first of all assumes the GH random is uniform (not a good assumption…)

@akilli I think that’s my first issue. Perhaps random INTO bell curve wasn’t what I’m after, but the order values of the frequency bell curve (e.g. 0.1, 0.2, 0.5, 0.5, 0.8, 0.9) should BECOME randomized??

Using attractor points was the first approach that occurred to me, are you sure it isn’t adaptable?

@Joseph_Oster This is definitely a future version of this, for building heights to vary from Street X to Street Y (which does happen in some cities.) I also wanted to make one where there wasn’t such logic.

I tried something different. Instead of starting with random, I am plugging in a range into the graph mapper and then having the graph map it to “sinc.” This gets a lot closer to what I am picturing in my head.

I am attached to the graph matter because I am picturing the X axis as “height” and Y as “frequency,” but I don’t think grasshopper can read my mind lol.

Thanks both for spending time on this. Your questions and inputs definitely helped me learn new things!

make random buildings from a ground surface.gh (76.7 KB) (Surfaces are internalized but they are geolocated, so they will be way out in the XYZ world)
(Fixed to the newest version oops)