Random numbers in ActionScript3

Self Test

Think of the answer to each question, then hold the mouse over the answer button to see the answer.

1. If we want random pastel colors we would pick random values from ___ to ___ 200( or other high number) to 255

2. Write the statement to give num a random value from 5 to 12 num= Math.random()*8+5

3. Write the statement to give num a random y value that is on the stage num= Math.random()*stage.stageHeight;

4. Write the statement to give red a random value as part of creating a random color red= Math.random()*255;

5. To pick a random color you must give red, green, and blue random values from 0 to ___ 255

6. Write the statement to give num a random x value that is on the stage num= Math.random()*stage.stageWidth;

7. Write the statement to give num a random value from 7 to 12 num= Math.random()*6+7

8. Write the statement to give red a random high value as part of creating a random shade of red red= Math.random()*100+155;

9. How would we pick random shades of blue? Give red and green random low values, but give blue a random high value.

10. Write the statement to give num a random value from 1 to 6. num= Math.random()*6+1;

11. Write the statement to give num a random value from 2 to 9 num= Math.random()*8+2

12. Write the statement to give num a random value from 7 to 7 num= Math.random()*1+7

13. If we want random dark colors we would pick random values from ___ to ___ 0 to 150 (or other value less than 255)

LESSON

INDEX


Copyright © Hello World Publications. All rights reserved worldwide.

hello-world.com
Privacy
Policy

Site map

Hello-World

7990907625