okay hello okay uh there's a exists
warmer and warmer the more you're in
here it sucks losing clothing this is
where having to stop though processing
t-shirt okay hello again
here we are um okay so this video I want
to talk about probability really basic
really simple topic this is not some
elaborate five minute video about
complex statistics we really want to
just think about probability in a very
basic way I should say something kind of
about this which is I I forgot in my
original video and suddenly when I go
back and remake all these to be perfect
I will get this right that one of the
things about this material is we aren't
looking for scientific accuracy we're
not uh we're not here to you know
measure perfectly and recreate with with
amazing realism the exact simulated
representation of what happens in nature
on the screen I have a screen over that
I have to turn off because I keep
looking at it okay right that's how
we're here to do we are here to may have
to create the feeling of nature in our
programs sometimes that means hey look
at the science understand the science
right the science into our code
sometimes it means blend some
weird-looking images we made a Photoshop
together to kind of create the feeling
of nature
I think probability and randomness is a
place where we're kind of walking that
line a little bit we can use randomness
to sort of have this accidental
representation of nature in many ways
lots of things in nature are random but
are they purely random do they have a
pattern do they follow Gaussian
distributions of random numbers should
we use this sort of strange function
that produces a smooth madness let's
Perlin noise want to look at all these
topics but we're going to just start
with probability now let's go over here
and visit or they were going to visit
our random walker it's been running for
quite a while and we can see that it's
creating this kind of nice random
patterns kind of that's how I would
describe it um and it's working out
quite nicely so what is the thing what
how does this random walker relate to
probability okay now we see over here
this is this is a set of options that a
random Walker at any moment will
can choose from it can go to the right
to the top is the left over to the
bottom with equal probability a 25 one
out of four chance of moving to the
right a one out of four chance of moving
to the top left and bottom that's a 25%
chance each and in fact when we use the
random function and processing for
example if we want to pick a random
number a random integer and I think we
did this in our code this will give us a
0 1 2 or 3 we have an equal probability
of picking any one of those a 25% chance
of 0 20% and 1 2 3 so this is where we
start to realize hmm is this how nature
works for example what if we wanted to
pick random Heights we're going to
create a population of meerkats and
we're going to give them all a random
height now I don't really know if you
compare cats though it's probably a bad
example to pick but I have a guess when
will the meerkat experts will weigh in
in the interactive commenting system we
have below which I don't know if it
exists and tell me about this whether or
not I'm right or not ok let's say we
could pick meerkats with the height of 0
1 2 or 3 we'll have 0 also doesn't make
any sense but just go with this it's
more likely that most of the meerkats
meerkats all have a height of around 1.5
right somewhere in the middle there the
mean right maybe there are rare very
rarely some outliers that are very tall
or very short and perhaps the meerkats
follow this kind of bell curve a
Gaussian distribution a normal
distribution of of numbers of heights
and so I got that's going to be stay
tuned this is coming soon and in the
next video for you we're going to talk
more about how this works and we're
actually looking at doing a Gaussian
distribution of random numbers in
processing but before we get there let's
just think of some simpler ways we might
do this what if for example we want to
adjust these probabilities what if we
wanted to say that our random Walker has
actually a 50% chance of moving to the
right and
it has a 20% chance of moving to the
left a 15% chance of moving up and a 15%
chance of moving down these could I hope
that that's up 200 hit us if I'm wrong
I'm wrong how could we implement
something like this in processing we
need to figure out how to have custom
distributions of random numbers now this
computer over here went to sleep
which means I'm standing in front no
came back online this program down here
is going to give us a clue if you look
at this is a particle system it's an
example that's coming up in a chapter on
chapter week lesson video whatever in
the particle system section which is
chapter 4 if you're following along in
the nature code book notice how often
it's making a particle definitely not
every frame and certainly not with
regularity we can't say particle
particle particle notes particle
particle particle particle it's making
every a particle every frame with I
would guess actually because just put an
example a 1% chance how do we have
something in processing happen with just
1% of the time look at this code now we
haven't done all this stuff all this
stuff is going to be we're going to get
later but we're looking at this line
right here if random 1 is less than 0.01
let's write that a different way if
random 100 is less than 10 here we're
picking a random number between 0 and
100 how often will that random number be
less than 10 10 percent of the time well
1 or less than 1 1 percent of the time
well we could also say random 1 less
than 0.01 same thing so this is a way
that we could just even begin to start
to affect our random Walker we could
actually if we go look over here again
we could see here is our random Walker a
traditional where we go down here and
look here are the choices 0 1 2 3 0 1 2
or 3 4 options equal probability each
time and if I go to this particular
example we can say hey what if that
random number we pick it's less than
point 4 go to the right
it's less than 0.6 go to the left these
are slightly different probabilities 40%
of going to the right
20% going up 20% going down and 20%
going to going back to the left and if I
run this we'll see what this random
Walker does we can see it's generally
speaking going to the right now what
effect out of me like these are not some
well before my heads in front of it I'll
just go stand over here these are not
earth-shattering examples ah hello these
are not earth-shattering examples but
these basics will get you started to
understanding something about
probability I don't want these videos to
be too long so I'm going to stop this
one and this is just sort of the basics
of creating event probability and
processing and what could you do with
that random Walker could you get it to
exhibit some type of pattern that has
randomness built into it what could you
do that would be even you know that
could get it to do something a little
bit more I know that has a quality of
something you're seeing Elston I'm not
sticking up if you get a script and a
director to make up we want you're
better so so that's that that's that's
the end of this one and so think about
that and we're going to look in the next
couple video series about actually
looking at Gaussian random numbers and
Perlin noise which I think will allow us
to do quite a bit more stuff ok I'm
going to hit stop