From the course: Processing: Interactive Data Visualization
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Shuffling with Java - Processing Tutorial
From the course: Processing: Interactive Data Visualization
Shuffling with Java
The last function I want to show you that deals with randomness in Processing is how to shuffle the items in an array. Now, you would think that this would be an easy thing to do, but unfortunately Processing does not have a built-in shuffle function and I've seen a number of people create rather long Byzantine complicated functions that can do shuffling. On the other hand, there is a shortcut for this and it is because Processing is based on Java and while Processing does not have a built-in shuffle function, Java does and so what I'm going to show is you is how to import a little bit of Java code and run it to shuffle items in an array. Let's start by simply putting little comment up here at the top, with the sketch name and then I'm going to put -- I have to import a library and it's the Java utilities and so I write import and then java.util.* and that brings in all of the files within that particular folder and once I get that in, I can then define my array. Now I'm going to use…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
Incorporating randomness7m 59s
-
Using Perlin noise4m 24s
-
Shuffling with Java3m 30s
-
Specifying line attributes8m 2s
-
Changing placement modes5m 45s
-
Understanding color attributes and functions4m 16s
-
Exploring color spaces7m 44s
-
Using color palettes7m 5s
-
Transforming the grid8m 38s
-
Exploring the attribute matrix5m 33s
-
-
-
-
-
-
-
-
-
-
-