designcoding
About Table of Contents Keywords Monthly Archive
Support designcoding!

Regenerating Random Numbers

January 2, 2013 | Algorithms
#grasshopper #random #rhino-python #timer #vbnet

Just a quick tip as I thought might be useful in some cases. Generating random numbers in architectural scripting is not a too catchy thing for designers. It is for sure, we want every parameter to be under our control (as if it were possible!). I was thinking about that in Grasshopper. A dataflow graph such as in Grasshopper regenerates whenever necessary (a change on an input value “fires” every connected component), therefore random number component requires your action (for example changing a seed value using a slider) in order to regenerate again. I tried to connect a timer component to random but could not tell it to regenerate numbers in a timed interval. So, I wrote a vb.net component including a very simple code in it. It just generates a random integer between 0-100 as displayed above. Below is the code within the VB component, you can change “100” to your desired range there. Now, if you connect a timer component, you’ll see that it works now.

Regenerating Random Numbers animation
Regenerating Random Numbers grasshopper, random

Here is the same functionality with the new Python Script component:

Regenerating Random Numbers rhino-python, timer

Here is the Grasshopper definition if you want to try both scripting environments (note that the Python script component is a part of Grasshopper for Rhino 5):

Grasshopper definition (GHX)Download

Cite this post

Yazar, T. (2013, January 2). Regenerating Random Numbers. designcoding. Retrieved August 24, 2026, from https://www.designcoding.net/regenerating-random-numbers/

Related Posts

Metronome Continued

July 19, 2012

Here is today’s improvement on my metronome with the timer component, which started here. It’s straightforward to tell Grasshopper about seconds and organize it according to it. Using an interval smaller than 1 second, this small script catches every second and returns a different value. However, it’s much harder to implement smaller values than seconds. It seemed easy at first sight but getting accurate results smaller than seconds requires working with milliseconds. You can output the current millisecond’s value, but…

Timer Component

July 16, 2012

This is probably the most simple definition on this site but I think it’s very useful. The timer is a special component of Grasshopper that is significant in terms of the real-time sketching paradigm. This basic use of a timer includes a 1-second update to a Vb script. Inside the script, the system date’s seconds are returned, so we see a real-time increasing number at output A. Beyond this point, It’s up to your imagination, how you can use that…

Spiral of Random

October 21, 2013

Grasshopper still surprises me. This definition draws a spiral by using a random component. It is obvious that the seed value of the random component has a relationship with an archimedean or a similar spiral. My intention was to create a definition to put a number of random points inside a circular area, not a rectangular one. While I grow the radius of a circle and get a t parameter evaluation from a random component using the same seed value…

Headbanging Points

December 20, 2013

In this fun experiment, points rock and roll! It should be based on a sound input of course but this is only a test to see if I can handle a timer and graph input at the same time. I’ll modify this definition to actuate with sound.  The use of the timer component gives a certain degree of randomness to the overall formation. To run this definition we need a VB script to update a certain value. The code inside of…

Karyokinesis

November 2, 2013

While searching for a way to work with random points and growing populations, this idea appeared accidentally. I wasn’t trying to mimic the behavior of Karyokinesis of biological cells (in fact I’m in serious doubt about biomimicry in general). The trick is to use a timer + data recorder + a knob for the arbitrary user input. It starts to breed when you start the timer, but to change the evolution speed, just roll the knob!  Of course, the knob…

  • Chapters

    • Algorithms
    • Discourses
    • Fabrications
    • Studios
  • Explore

    • All Keywords
    • Table of Contents
    • Monthly Archive
    • #polyhedra
    • #parametric-surface
    • #robot
    • #tessellation
    • #boolean
    • #kuka-prc
    • #dome
    • #parametric-curve
    • #design-object
    • #image-sampler
    • #linear-algebra
    • #terrain
    • #sandblasting
    • #stone
    • #animation
    • #cycloid
    • #art
    • #aperiodic
    • #tiling
    • #tutorial
  • Search

  • Support designcoding!

  • Enjoying designcoding? Support me on Patreon to keep it growing. Thank you!

  • copyright 2026 designcoding.net | about | privacy policy | end user license agreement