Recently in my current project there were a 'guid' field as per requirement of client. I had to generate the guid in that field.
I thought of writing this function for generating random guid in 'guid' field.
Step 1- Get the Schema name and field name of field where to generate the random guid.
Step 2- Create Function-

Step 3- Copy and paste the function into Form.js in CRM which is called on form load in CRM.
Step 4- Call the function on field change event (as per requirement "Optional").
Step 5- Click on OK and then Save and Publish.