Alice in Action with Java - PowerPoint PPT Presentation

1 / 5
About This Presentation
Title:

Alice in Action with Java

Description:

programs that test other programs sometimes generate random sets of data ... You can also specify integers only. choose true x% of the time. Alice in Action with Java ... – PowerPoint PPT presentation

Number of Views:38
Avg rating:3.0/5.0
Slides: 6
Provided by: course228
Learn more at: http://cs.boisestate.edu
Category:
Tags: action | alice | java | testing

less

Transcript and Presenter's Notes

Title: Alice in Action with Java


1
Alice in Action with Java
  • Chapter 5
  • Random Numbers

2
Random Numbers
  • Certain kinds of applications need random numbers
  • simulations
  • games
  • encryption utilities use random numbers to create
    a code for scrambling the data being encrypted
  • programs that test other programs sometimes
    generate random sets of data

3
Random Numbers in Alice
  • The world has two functions
  • random number
  • by default the function returns a number between
    0 and 1
  • You can tell the function to use a different
    range by selecting more and then fill in the
    minimum and maximum values
  • You can also specify integers only
  • choose true x of the time

4
Random Motion
  • You could make an alice object move a random
    distance in a random direction with a
  • do together
  • move forward/backwards by a random amount
  • move up/down by a random amount
  • move left/right by a random amount

5
Choose true
  • If you have an action that needs to happen some
    percentage of the time there is a world function
    to use
  • Select choose true from the world's methods
  • select a per cent value
Write a Comment
User Comments (0)
About PowerShow.com