Yanfly BattleEngine Core - Action Speed Error

This is the code I've got in the Action Speed parameter box for Yanfly's BattleEngine Core script:
if(agi>50){1}else if(math.randomInt(20)+1<agi){2}else{0}

Basically, if the AGI for the battler is above 50 (i.e., they are an enemy), I want their Action Speed to be 1. Otherwise: if their AGI is greater than a random number, I want their Action Speed to be 2; otherwise, 0.

This is the error I get:
"ReferenceError: math is not defined".

What is going on here? Is it possible to do what I'd like?

EDIT: Yanfly's Battle Engine Core script
Since JavaScript is case-sensitive, you need to reference "Math", not "math".

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-battleengine-core-action-speed-error.106002/