now generating helper functions: init,valid,random