So now let's actually look at all these lines of code here.
So a low number 374 as you can see we have actually a variable of type Integer.
And the name of this variable is zero.
And here as you can see it refers to the name of this object.
Secure random number.
So they're actually the job of this object is to actually create a random number right.
So set your random number the next event.
So here is going to create an integer or random number for us from 0 to the value that we specify here.
So secure random number that next int number of animals just rose.
So now let me show you the emulator here.
As you can see these are emulated right and now a number of animals just rules variable is going to
hold the value that actually that is showing us the number of animals gets through.
So for example as you can see we have to guess the rules here.
The first one is here is this one that actually holds these two buttons.
The first one is on it and the second one is horse and the second gets through here.
This is what that second guess gastro that contains these two buttons the first button is flappy bird
and the second button is penguin.
So this number of animals gets through here.
It's going to hold the number of the guests the rows that we have inside the quiz.
So now I want to actually create I want to generate actually a random number between 0 and the number
of animals just rows that we have here.
So for example if you have actually to guess who's here right.
So now it's going to actually generate a value of random value between 0 and 1 right between 0 and 2
but not including number two because it's not going to include the final value.
So for example here we have to get throws.
So it can actually generate a random number between 0 and the number one is not going I should include
the number two here.
Right.
So when we write to secure random number the next number of months gets throws it's going to actually
generate a random number between 0 and this value here that we specify number of animals get through
us but not including disvalue.
So for example this value is too right.
We have to guess throws so random that value that this object here is going to generate is actually
a zero all number of what.
So set your random number the next number of animals get through.
It's going to generate a random value between a zero or number one.
So and then it's actually a sign that randomly generated value which is often integer to this row of
valuable so this variable is going to either hold the value at number 0 or the value number one.
Right and then a line number 375.
We have actually another variable and the name of this variable is column.
And then I put an assignment operator here and now but again I want to actually generate another random
value secure random number that next ain't two.
So now I'm 100 percent sure that each row inside the crease has two columns.
So as you can see here this through here has two columns as you can see here two buttons and so here
is also has has also has actually two columns two buttons right.
So I am 100 percent sure that I have actually two columns inside each row so secure random number next
it to.
So it's going I should again generate a random value between 0 and 2 but not including this value.
Number 2.
So it's going to either generate the value zero or devalue another one.
So then it's going to actually assign that generated random value which is of that integers to this
column variable.
So this kind of variable is going to have either the value 0 or the value number one.
And then let's look at this line of code here in line number three hundred and 76 linearly out random
row.
So now you may ask that what is the purpose of these lines of code here.
The purpose of these lines of code is to actually a substitute one of the options of.
Correct answer.
So when we actually put these values here we are actually as you can see if you scroll to the top here
we are actually specifying some randomly generated buttons someone randomly generated values for the
guest options and we have not yet actually specified the actually the correct answer.
We just generated these buttons with the random values but not including the answer.
And that's why you can see that we actually removed that.
The correct answer as you can see here in the look at these lines of what he really moved.
The correct answer from the all animals named All animals are names at list here.
And then we actually add it again that correct answer to that actually to the last index of these all
animals named names here.
And you can see that we actually generated these buttons with the values as you can see here.
But our look at these lines of code here.
Now I want to actually substitute one of the buttons with the correct answer.
Right.
So here as you can see look at this for loop here it is for loop here.
It's going to actually generate four buttons with four different animal values.
Right.
But not the answer.
So look at this flappy bird here.
So it's going to actually put this flappy bird image here and we must guess the name of this animal.
Right.
But this for loop here is going to actually put four different animal names but not the answer because
here we actually put the answer at the end of the list.
And here as you can see here it is for Lapeer.
It's going to actually just get the animal names from there.
Actually the beginning of the list as you can see here.
Right.
If you look at these two lines of code here and if you just experiment with these two lines of code
here you can see that you're actually getting the animal names from the beginning of the list.
And here we actually added the animal named the correct animal name a tree that actually the last index
of the list.
And here as you can see we want to actually substitute one of the gifts options to be the correct answer.
And that's why you want to choose the correct the randomly generated row as you can see here.
And then I want to choose the randomly generated column and then here in line number three hundred and
seventy six.
As you can see I created a linearly out of a variable of type linearly out and the name of this but
is a random row right.
Assignment operator rows of just spottiness in animalcules.
So this is actually an army that actually holds values of type linearly out right.
So rows of spottiness in animal is Sub-Zero.
So it's going to actually look at this area here.
So now if I actually scroll to the top here inside this class you can see that we actually created this
at a here in line number 61.
So linear layout and array of linearly out as you can see here and then Aimee's loss of spottiness in
animal cuius.
And you can see that inside this uncreate view we actually initialized this out here as you can see
here with these rows.
But here if you scroll down here let's scroll down here and look at these lines of code.
Here you can see that in line number three hundred and seventy six are referred to that are a.
And I want to get our random row as you can see here.
Right.
So for example we have two rows here.
I want to get that random blow for example Destro or the slope.
And then here look at this line of code here in line number three hundred and seventy seven.
So as you can see in this line of Cahir it can actually get a random group and it and then he's going
to assign that random group to this random group variable here that we create here in like number three
hundred and 376 in line number three hundred and seventy seven.
We created another variable and the name of this variable is animal emergency.
Right.
And then I put an assignment operator here and I called the Smurfette get the exact animal name.
And then I passed the correct animal's answer to this method.
Right.
So now as you can see here this variable here now holds the correct answer.
So here we can actually change this name change the name of this variable to another value that is more
meaningful.
So correct animal image name.
Right.
So I can actually just type in here correct.
Excuse me it's not capitalized.
Correct animal image.
As you can see here.
Now it's more meaningful.
And now this variable now holds the correct answer in line number three hundred and seventy eight.
As you can see here.
Look at this piece of code here.
Look just look at this piece of code inside Apprentice's as you can see I am actually testing this object
we bought an object I'm not creating a valuable here I'm just creating an object here.
And as you can see I am referring to this random row here right.
I'm referring to the random glue that get child at column right a random column as you can see here.
Right.
So random row that get tight at a column.
So this column you have now holds a random value between zero and number one as you can see here.
Dot as you can see here that set text.
So here because we actually tested this value to a button object I can call this method and this value
here as you can see right dot set text correct animal image name correct animal imagery and that's how
I can actually substitute one of the gifts options with the correct answer.
So it's going to actually look at one of the random rows and it's going to actually get one of the columns
are randomly selected column as you can see here.
And then it's going to actually call this effect on this value because we actually tested this value
here to add but an update as you can see here we can call this method on this here.
So our set takes.
Correct.
And in one image name.
So now it's going to be set to one of the set that takes up one of the options.
One of the options with the correct and emoluments name.
So hopefully that makes sense.
And now we need to actually create some other MFX here inside this class.