fixed multithreading issue with rand()
made parallel processing optional, improved example expressions