Skip to main content

Random Decimal

A random decimal between 0 and 1.

Random Decimal block

Description

The Random Decimal block returns a random decimal between 0 and 1. This is a code block from the Math drawer.

Usage

A random decimal between 0 and 1.

Syntax

This block has no inputs.

Example

This model simulates the progression of an epidemic with some random initial infected population (e.g. a foodborne disease). By using the with percent chance block over a large number of turtles, the initial fraction of sick turtles is approximately the random decimal * 100.

Random Decimal example code