Brackets

Hi
I have been using action script at a very basic level for years. However I am trying to improve my knowlege. One of the things that confuses me is when to use what type of bracket. When ever you read a tutorial or book, however basic is just tells you what brackect to use without any explaination.

Here is an example of my confusion

var p = random(ivar);
var t = this[ivar];

why the 2 types of brakects and whats the difference

Dose any one know of any good links or stuff to help expaline brackets

Cheers