import random


def sample_gamma(alpha, beta):
    """
    Sample gamma variate for small alpha, using
    transformation from Marsaglia&Tsang method
    
    http://www.hongliangjie.com/2012/12/19/how-to-generate-gamma-random-variables/
    """
    
    x = random.gammavariate(alpha + 1.0, beta)
    
    return x * pow( random.random(), 1.0/alpha )