Table of Contents

pick random () to ()

Description

The block picks a pseudorandom number ranging from the first given number to the second, including both endpoints. If both numbers have no decimals, it will report a whole number. For example, if a 1 and a 3 were inputted, the block could return a 1, 2 or 3. If one of the numbers has a decimal point, even .0, it reports a number with a decimal. For example, if 0.1 and 0.14 were given, the output will be 0.1, 0.11, 0.12, 0.13, or 0.14.

Example

The example demonstrates the use of clone and gliding function in Sprite. 

The example demonstrates the use of clone and gliding function in Sprite:

  1. Whenever the sprite is clicked, a clone is created.
  2. When a clone is created its position is set to a random position on the top of the stage and then it glides down to the bottom.
  3. When it reaches the bottom, the clone is deleted.

Script

Output

Read More
The example demonstrates how to add gravity into the project on a bouncing ball.

Script

  1. Main Script to change the speed and position parameters of the ball.
  2. Custom function to initialize the ball position and speed with random variables.
  3. Custom function to check the boundary conditions and set the rules.

Output

Read More
The example demonstrates how to create a random colored LED pattern on Quarky.

Script

Output

Read More
In this example, we simulate the covid experiment using the physics simulation.

In this example, we simulate the covid experiment using the physics simulation. Following is what we are doing:

  1. 21 humans are created with 20 green and 1 red ball.
  2. Gravity is set to 0 simulating zero gravity.
  3. The balls move at random speeds constantly creating random behavior.
  4. If the green balls touch the red balls, it turns red.
  5. After 10 seconds the red ball gets converted to green.

Script

Output

Read More
All articles loaded
No more articles to load