I’m trying to generate a random number in javascript and I’ve hit a very frustrating issue. According to every script I’ve ever done, as well as 5 different websites to verify my sanity, random is done in javascript using Math.random(). I have a min and max that I want for the random to fall under, so I put this function together:

```
function randint( beg, end )
{
return Math.floor(((end - beg + 1)*Math.random()));
}
```

Unity returns an error:

unknown identifier ‘Math’.

I put together a script without the min/max to simplify things:

```
function randint()
{
var rand_no = Math.random();
return rand_no;
}
```

unknown identifier: ‘Math’.

Is it my fault trying to code in the brain fog shortly after waking up, or is something seriously wrong here?