ActionScript 3 Random Value Generation Random number between min and max values

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

function randomMinMax(min:Number, max:Number):Number {
    return (min + (Math.random() * Math.abs(max - min)));
}

This function is called by passing a range of minimum and maximum values.

Example:

randomMinMax(1, 10);

Example outputs:

  • 1.661770915146917
  • 2.5521070677787066
  • 9.436270965728909


Got any ActionScript 3 Question?