Scratch for Java

Stage::pickRandom()

Picks a random number between the two limits.

Examples

import org.openpatch.scratch.*;
 
public class StagePickRandom {
  public StagePickRandom() {
    Stage myStage = new Stage(600, 240);
    while (myStage.getTimer().forMillis(3000)) {
      int random = myStage.pickRandom(0, 100);
      myStage.display("Random: " + random);
      myStage.wait(500);
    }
    myStage.exit();
  }
 
  public static void main(String[] args) {
    new StagePickRandom();
  }
}
 

View on GitHub

Syntax

Java

.pickRandom(min, max)

Scratch

pick random () to ()

Parameters

Name Data Type Description
min int Minimal integer.
max int Maximal integer.

Return

int

pickRandom()