implemented Sampler class