src/Image.php
protected function getRGBFromRange($r, $g, $b, $range) {
		#	get randomized rgb values on a specific range from a agiven value

		if (!$range) {
			return array($r, $g, $b);
		}

		$range = round($range / 2);
		$color = array();

		# red
		$min = $r - $range;
		$max = $r + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['r'] = $color[0] = rand($min, $max);

		# Green
		$min = $g - $range;
		$max = $g + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['g'] = $color[1] = rand($min, $max);

		# blue
		$min = $b - $range;
		$max = $b + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['b'] = $color[2] = rand($min, $max);

		return $color;
	}
protected function getRGBFromRange($r, $g, $b, $range) {
		#	get randomized rgb values on a specific range from a agiven value

		if (!$range) {
			return array($r, $g, $b);
		}

		$range = round($range / 2);
		$color = array();

		# red
		$min = $r - $range;
		$max = $r + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['r'] = $color[0] = rand($min, $max);

		# Green
		$min = $g - $range;
		$max = $g + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['g'] = $color[1] = rand($min, $max);

		# blue
		$min = $b - $range;
		$max = $b + $range;

		if ($min < 0) {
			$min = 0;
		}

		if ($max > 255) {
			$max = 255;
		}

		$color['b'] = $color[2] = rand($min, $max);

		return $color;
	}
protected function getRGBFromRange ( $ r , $ g , $ b , $ range ) { #	get randomized rgb values on a specific range from a agiven value if ( ! $ range ) { return array ( $ r , $ g , $ b ) ; } $ range = round ( $ range / 2 ) ; $ color = array ( ) ; # red $ min = $ r - $ range ; $ max = $ r + $ range ; if ( $ min < 0 ) { $ min = 0 ; } if ( $ max > 255 ) { $ max = 255 ; } $ color [ 'r' ] = $ color [ 0 ] = rand ( $ min , $ max ) ; # Green $ min = $ g - $ range ; $ max = $ g + $ range ; if ( $ min < 0 ) { $ min = 0 ; } if ( $ max > 255 ) { $ max = 255 ; } $ color [ 'g' ] = $ color [ 1 ] = rand ( $ min , $ max ) ; # blue $ min = $ b - $ range ; $ max = $ b + $ range ; if ( $ min < 0 ) { $ min = 0 ; } if ( $ max > 255 ) { $ max = 255 ; } $ color [ 'b' ] = $ color [ 2 ] = rand ( $ min , $ max ) ; return $ color ; }
Get Random RGB Values on a specific range
@param  integer $r     Red
@param  integer $g     Green
@param  integer $b     Blue
@param  integer $range Range to randomize given values
@return array        array of randomized rgb
Get Random RGB Values on a specific range