HOW TO
In ArcGIS Online and Portal for ArcGIS Map Viewer, a random number within a range can be generated using Arcade expressions to label each feature on the map. This allows for a better visualization of the random classification on a map when performing predictive analysis.
This article provides an example and instructions using Arcade expressions to generate a random number within a range for labels in Map Viewer.
The image below shows a map in Map Viewer without random numbers on the polygon features.
Round(Random() * (<valueDigit1> - <valueDigit2>) + <valueDigit2> , <numberOfDecimal>)
The code block below is an example of the full working expression to generate a random round number between 0 to 50.
Round(Random() * (0 - 50) + 50 , 0)
The image below shows the labels with random numbers on the map in ArcGIS Online Map Viewer after running the Arcade expression.
Article ID: 000028949
Get help from ArcGIS experts
Download the Esri Support App