Create primitives.py

Basic primitives for 8 functions related to sampling