Limit distribution of class numbers for discriminants in progressions and fundamental discriminants