Skip to content

Commit

Permalink
Merge pull request #926 from Kefta/patch-13
Browse files Browse the repository at this point in the history
Add ColorRand
  • Loading branch information
robotboy655 committed Apr 19, 2015
2 parents 72a7452 + f376efb commit f98ea15
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion garrysmod/lua/includes/util.lua
Expand Up @@ -82,6 +82,19 @@ function AngleRand()
return Angle( math.Rand( -90, 90 ), math.Rand( -180, 180 ), math.Rand( -180, 180 ) )
end
--[[---------------------------------------------------------
Returns a random color
-----------------------------------------------------------]]
function ColorRand( alpha )
if ( alpha ) then
return Color( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) )
end
return Color( math.random( 0, 255 ), math.random( 0, 255 ), math.random( 0, 255 ) )
end
--[[---------------------------------------------------------
Convenience function to precache a sound
-----------------------------------------------------------]]
Expand Down Expand Up @@ -356,4 +369,4 @@ if ( CLIENT ) then
end
end
end

0 comments on commit f98ea15

Please sign in to comment.