"""Dont know how to check for errors numerically because of to many iterations or how to check by derivation proof """ from random import randrange """Random rgb color combination 0<=red<=255 0<=green<=255 0<=blue<=255 Supposed to be all combinations of integers from span above 255**3 """ def Random_Rgb(): a = randrange(0,255**3+1,1) red=0 green=0 blue=0 #One red cycle while a >= 255**2: a -= 255**2 red += 1 #Green cycles while a >= 255: a -= 255 green += 1 green += (red*255)%255 #Blue cycles while a >= 1: a -= 1 blue += 1 blue += (red*255*255)%255 + (green*255)%255 return red, green, blue red, green, blue = Random_Rgb() print(red,green,blue)
for i in range(10): # set loop count to however many samples you want red = random.randrange(256) green = random.randrange(256) blue = random.randrange(256) print("Colour:", red, green, blue)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)