title: Is there a way tor apply a random color to change the style of the selected points to that color
body: <p>So I have a random color function that I want to apply to a selection of points but it gives me a random color for each point rather one random color for the selection of points.I know the selecting part works but I'm not sure how to make it call upon that random color generator only once per color.  Here is what I have so far. Thanks for any advice/help!</p>
  <pre><code>include &quot;mapbasic.def&quot;
  include &quot;menu.def&quot;
  include &quot;icons.def&quot;
  
  Declare Sub Main
  Declare Sub Color
  Declare Sub RndColor
  
  
  
  Declare Function ChangeSymbolColour (ByVal objTarget as Object, ByVal stringAttribute as String) as Object
  
  ' ==========================
  
  Sub Main
  
  Dim i, nRecords as integer
  Dim ColValue As Alias
  Dim s_ColValues(50) as String
  
  
  '// - Query your table and group wanted column (list of unique values)
  Select Symbology from YOUR_TABLE2 group by Symbology into UNIQUE_values
  
  '// - Populate array with all unique values (from first column in UNIQUE_values table)
  print &quot;new&quot;  
    For i = 1 to SelectionInfo(SEL_INFO_NROWS)         
      ReDim s_ColValues(i)
      Fetch rec i From UNIQUE_values
  
      ColValue = UNIQUE_values + &quot;.col1&quot;
  
      s_ColValues(i) = ColValue
  
  Select * from Your_Table2 where Symbology= s_ColValues(i) into Selection
  
  Call Color
  
  Next
  
  End Sub
  
  Sub RndColor
  
  Dim Color as integer
  
  Color = RGB((254*Rnd(1)+1),(254*Rnd(1)+1),(254*Rnd(1)+1))
  
  End Sub
  
  Sub Color
  
  
  Update Your_table2 set Obj = ChangeSymbolColour(obj, symbology)
  
  
  End Sub
  
  
  
  Function ChangeSymbolColour (ByVal objTarget as Object, ByVal stringAttribute as String) as Object
  
  Dim newSymbol as Symbol
  Dim nColour as Integer
  'nColour=RGB((254*Rnd(1)+1),(254*Rnd(1)+1),(254*Rnd(1)+1))
  ncolour=RED
  
  newSymbol = MakeFontSymbol(36, nColour, 5, &quot;Map Symbols&quot;, 0, 0) 
  Alter Object objTarget Info OBJ_INFO_SYMBOL, newSymbol
  ChangeSymbolColour = objTarget
  End Function
  </code></pre>