Every programming language has a method for generating random numbers and

*Scratch*is no exception.
Load

*Scratch*, look in the green*Operators*menu, and you will find a*pick random*block. Drag a (pick random) block into the scripting section.
Continually click on the block and it will report a string of numbers, 1 though 10.

Change the 10 to 6, click on the block several times and note that the numerical results are similar to what you would obtain by rolling a single die.

The

*pick random*block actually generates*pseudo-random*numbers. Since every operation in every programming language has to be based on algorithms,*Scratch*, like every other language, must contain an*algorithm*(the antithesis of a*random*process) that generates numbers that 'look like' random numbers. Hence, the term pseudo-random numbers. A popular class of algorithms that generate pseudo-random numbers are called*linear congruential generators*and constitute a major topic in contemporary mathematics.
If you are interested, request the

*Linear Congruential Generator.pdf*, a four-page document that works through the mathematics and provides a Scratch script that implements the Park-Miller parameter set.
Psuedo-random numbers, hereafter called

*random*numbers, are fun to play with and*Scratch*(or any other programming or scripting language) provide students the opportunity to develop dynamic solutions to many types of mathematical problems. Here's a problem in*geometrical probability*.
Consider a square is divided into four smaller, congruent squares. The square in the upper right has been shaded.

The following

*Scratch*block, used in a*Repeat*block, can be used to generate 100 random points in the above square.
How many of the 100 points would you expect to fall in the shaded square?

One could argue that since the four smaller squares are congruent, the area of the shaded square is one-fourth the area of the large square. Since the probability of picking any point is equal to the probability of picking any other point, the expectation is that 25 of the100 points, or one-fourth, would fall in the shaded area.

As you readily see in the graphic shown below, this problem is easily modeled in

*Scratch.*The red circular sprite,*sprite 1*, is used to plot each random (x, y) point.
A yellow sprite,

*sprite 2*, is a square with one-quarter the area of the large square (see left screenshot below). Since the yellow square is a sprite, you can click on it and move the yellow square around (see screenshot on right) within (or even outside of) the larger square. This makes the problem*dynamic*, as compared to the*static*example given at the beginning of this lecture.
When the program is executed (click on the green flag) 100 trials of 100 random points are computed and averaged. As you can see in the left screenshot, the average for the 100 trials is 25.27. The average for the screenshot on the right is 24.62. Both averages are close to the theoretical value of 25.

This project can be viewed and downloaded by clicking on this link:

Great article regarding the usage of random no.in scratch.Many of us dint know about the proper utilization of it,you have helped us a lot.

ReplyDeleteReally impressed! Everything is very open and very clear clarification of issues. It contains truly facts. Your website is very valuable. Thanks for sharing. The Random Blogger

ReplyDeleteOur writers can help you with any or the majority of the theory or exposition composing steps or with an article or paper at assignment writing services uk .Scholarly life surely has its difficulties, including extreme due dates, heaps of homework and composing ventures, just as restricted time to destroy them.

ReplyDeleteHere is the best leather jacket named by Events sale that i am showing to you. we provide the best leather quality that you are looking for. here is the link. visit to the website and read more.

ReplyDeleteWrite My Assignment In addition to this, we offer legitimate academic services to students around the world. If you want to know more about our business and people, please visit our About Us page now.

ReplyDeleteBuild a powerful e-commerce store with high-end features now in 5 Days.

ReplyDelete