URScript Random Number Generator

Hello,

I am working on a program that scans a part using an LMI line scanner, determines weather the part is passing or rejected. There are 8 parts, 4 good 4 bad. They start in a 2x4 pallet in a random arrangement and one by one get sorted into 2, 2x2 pallets, one passing one rejected. Once all 8 are sorted, I want to get some sort of random (most likely not completely random but random enough) number generator going to have the UR place the parts back into the starting pallet again in a random arrangement. If anyone has something i can reference to accomplish this, that would be great.

Rand_Num := ceil(random()*8) # random() produces float between 0-1

Not sure if ceil(1*8) produces 9 (it shouldn’t but math is difficult sometimes, if it does use 7), this is me shooting from the hip. Also, you might have to keep track of Rand_Num if it is generated multiple times and have an array or something that tracks this.

Anyways someone else in the community might have a better solution. Hope this helps and best of luck!