Ok, cool. Thanks for your help with this, David.
Matt
Radlab, Incorporated
25 Drydock Ave, Floor 6
Boston, MA 02210
W| radlabinc dot com
E| matt@radlabinc
P| 617.440.3588
Added by Matt Trimble at 8:54am on November 19, 2009
t, let's talk about randomness. Randomness is a problem in computing because digital computers are deterministic. If you give them the exact same instructions they always end up with the exact same result. It turns out to be mathematically impossible to generate true random numbers using a digital computer, but it is fairly easy to generate pseudo-random numbers. This is actually not bad news as pseudo-random numbers -unlike real random numbers- can be generated again and again and you'll end up with the same random numbers every time. Being able to get the same random numbers on demand increases the reliability of these number sequences which in turn makes them easier to use.
Pseudo-random numbers are numbers that have certain characteristics. Note that when we talk about random numbers we are really talking about numbers. Plural. It's easy to generate only a single one, as xkcd so eloquently put it:
So what are these characteristics that define pseudo-randomness? Without being actually correct, I can sum them up as follows:
The sequence of generated numbers should never repeat itself*
The numbers in the sequence ought to be spread evenly across the numeric domain**
There are a lot of different algorithms out there, some better than others, some faster than others, some solving very specific problems while others are more generic. The generator used in Grasshopper is the standard Microsoft .NET Random, based on Donald Knuth's subtractive algorithm.
So let's imagine we want random integers between 0 and 10. What would a bad random sequence look like?
3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 (about as bad as it gets)
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 (not random at all)
1 3 2 5 3 9 1 2 4 2 5 1 1 2 8 1 5 2 3 4 (too many low numbers)
2 8 4 6 0 9 8 2 4 8 6 4 2 2 5 1 4 8 6 2 (too many even numbers)
So what about good sequences? Well, here's a few:
6 9 1 2 0 4 2 8 5 7 2 9 1 9 2 5 3 1 9 2 (sure, why not)
6 2 5 3 4 1 9 7 8 0 2 1 6 4 5 8 9 5 0 9 (looks about right)
1 8 5 2 3 4 5 7 9 5 2 1 0 2 1 0 9 7 6 4 (I suppose)
9 0 6 4 8 3 1 5 2 7 6 1 4 6 0 1 9 7 5 6 (whatever)
There are a lot of valid pseudo-random sequences. (Seriously, loads). So even if we have a good pseudo-random generator we may be given a random sequence that isn't entirely to our liking. The shorter the sequence we need, the more likely it is that statistical aberrations invalidate that particular sequence for us. What we need is some control over the generator so we don't just get a repeatable sequence, but a repeatable sequence we actually like.
Enter seed values. The random generator requires a seed value before it can generate a random sequence. These seed values are always integers, and they can be any valid 32-bit integer. Every unique seed value results in the same sequence. Every time.
Unfortunately there is no clear relationship between seeds and sequences. Changing the seed value from 5 to 6 will result in a completely difference random sequence, and two sequences that are very similar may well have to wildly different seeds. There is therefore no way to guess a good seed value, it is completely trial-and-error. Also because of this extremely discontinuous nature, you cannot use tools like Galapagos to optimize a seed value.
If you are looking for a pseudo-random sequence which has custom characteristics, you may well end up having to write your own generator algorithm. Ask questions about this on the Grasshopper main forum or the VB/C# forum.
Conclusion: Seed values are integers that define the exact sequence of pseudo-random numbers, but there's no way of knowing ahead of time what sequence it will be and there's no way of tweaking a sequence by slightly changing the seed. Even the tiniest change in seed value will result in a radically different random sequence.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
* This is not actually possible. A finite amount of numbers always repeats itself eventually.
** This should only be true for long enough sequences, short sequences are allowed to cluster their values somewhat.
Interesting links for further reading:
Coding Horror: Computers are Louse Random Number Generators
StackOverflow: When do random numbers start repeating?…
Added by David Rutten at 9:52am on October 20, 2012
a seed, and instead creating a pattern where each color has a seed/control slider for each row? For example, row 1: brown 2, tan 6, yellow 7, purple 3, repeat. row 2: brown 6, tan 1, yellow 4, purple 10, repeat. row 3: yellow 5, purple 1, brown 3, tan 10, repeat. row 4: purple 2, brown 7, tan 3, yellow 4, repeat. Then repeat that sequence up the wall? For each color, the number in the sequence should be adjustable.
Thank you again for your help!…
{0;1;0}N=6
{0;1;1}N=6
{0;1;2}N=5
{0;2;0}N=7
{0;2;1}N=8
{0;2;2}N=9
Can you shift and wrap any of the paths A B or C?
Say if I wanted to shift and wrap B by 1 to get the following...
{0;0;0}N=7
{0;0;1}N=8
{0;0;2}N=9
{0;1;0}N=3
{0;1;1}N=2
{0;1;2}N=5
{0;2;0}N=6
{0;2;1}N=6
{0;2;2}N=5…
hem. Now I need to search through the original points that comprise the voronoi diagram and replace them with the new averaged points. I need to do this while still preserving the logic of the old data tree which is comprised of {i}j values. In other words each point is grouped into a vornoi cell so that the cells can be created with the polyline component
I believe I have a relatively simple solution, but need help create a python script that searches and replaces values within a data tree.See the psuedo code below:
Psuedo-Code:
For each item(i) in Data tree B (list of index values points to be replaced grouped into a data tree corresponding to the new point) find the corresponding integer in Data tree C (list of points grouped around {i;j} values)Then replace the integer in Data Tree C with the key value (the data tree path) that corresponds to the item from Data tree B that is replacing the item from Data tree CFor example:Data Tree B{14}(0)2(1)3(2)6(3)11(4)13(5)14Data Tree C{0;1}(0)2(1)3(2)6Output:Data Tree {0;1}(0){14}(1){14}(2){14}
List A - Single point (New Point) with Data Tree/Key value corresponding to group of points it will replace ( List B)
List B-list of index values of flattened voronoi point list with Data Tree/Key Value corresponding to List A - in other words these are all the points I need to replace with the point in List A
List C-list of index values of flattened voronoi point list with Data Tree/Key Value corresponding to {i}j values necessary to re-create voronoi cells with the polyline component
Once this is done I can use the Output and the new Points in List A to replace the set of old points in the original voronoi diagram with the new set up reduced points.
If there is another way to achieve the goal of eliminating small edges of a vorononi diagram, I'm open to suggestions.
…
t item (see the image), is it possible to do this in another way (quickly) ?
Is it possible to divide that curve into 2 separate curves using a point that i've used for the division?
Thanks…
Added by luca.pavarin at 4:08pm on January 7, 2010
Hi,
I want to divide curve with distance between points so it will be like this:
1--2---3----4-----5------6-------7-----, ...
with values in range 1 to 50, must be simple but im stuck..
tnx