why is o sometimes pronounced like an a?? for example. the word "kogda" is pronounce "kagda" but "nemnogo" is pronounced "nemnogo".

Is there a pattern to this? If so I would greatly appreciate...