refactored vector, scalar and rand into helper.js