Replacing Random2 by individual do_functions with .Call interface.