Jump to content

Random number for self-center probing testing


Recommended Posts

I wanted to test self-centering probing with slightly different nominal values on each run, so GPT-4 wrote this code for me:

 

// Generate a pseudo-random number using system time and CMM position
LongStringOfNumbers = millisecondClockValue().asString.hash + getPositionCMM().x.asString.hash + getPositionCMM().y.asString.hash + getPositionCMM().z.asString.hash

// Convert the long string to a number
RandomHighValue = val(LongStringOfNumbers)

// Get a random number between 1 and 100
RandomValueBetween = mod(RandomHighValue, 100) + 1

 

I let it run overnight and it worked perfectly, but I'm not sure if I just got lucky or if it might cause unexpected behavior with CMM in the future.

So I all ears for your opinions.

 

Edited
×
×
  • Create New...