need help with random array value selection (syntax mostly)

howdy all.
bit of background first (sorry if this seems a bit ramble like ... my brain is hurting at this point)

i'm working on a tix clock
a picture of the layout is as below

it is basically a board with 4 banks of led's
arranged in 3 columns
the top row is a bank of 3
the second is a bank of 9
the third is a bank of 6
a fourth is a bank of 9

i have created 4 integers (digit1-digit4) that hold each digit of the time
eg 11:47pm (23:47 in 24 hour time) and i will use this time as the example going forward
digit 1 would contain 2
digit 2 would contain 3
digit 3 would contain 4
digit 4 would contain 7

i then created 4 arrays (1 for each bank of leds)

my problem is trying to create dynamic arrays that would
need to be the length of the digit value
ie array 1 would contain 2 values for the 2
array 2 would contain 3 values for the 3
so for the first hour digit i need to create an array of 2 values to be randomly selected from a const array containing pin numbers from that first bank
this display function would be run every 5 seconds to simulate a random rearranging of the lights that are lit to make it a little less dull
here is what i have so far(i started getting close (i think) before my lack of cognitive abilities failed me)

this is only a fragment and i got as far as outputting stuff in serial console to try and visualise it before i started getting really confused

const byte houra [] = {26, 25, 24};
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
const byte mina [] = {14, 13, 12, 11, 10, 9};
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);
 byte digit1pins [digit1];
  byte digit2pins [digit2];
   byte digit3pins [digit3];
    byte digit4pins [digit4];
 Serial.println("assigning digit 1 pins "); 
 for(int q = 0; q >= digit1-1; q++)

{
  int curr = houra[random(0, 2)];
digit1pins[q] = curr;
  Serial.println("q:");
    Serial.println(q);
  Serial.println("digit1pins:");
    Serial.println(digit1pins[q]);
      Serial.println("enddigit1pins");
}

edit: i think i would also need the random sequence to make sure i dont use the same pin twice
i understand if my approach is completly wrong and i need to start from scratch, and would really apreciate any help
again sorry i get really confused when running through loops and iterations in my head

my problem is trying to create dynamic arrays that would
need to be the length of the digit value
ie array 1 would contain 2 values for the 2
array 2 would contain 3 values for the 3

Why use arrays for this ?

Take digit 3 for example. Its value is 4 so you need 4 of its 6 LEDs turned on and you have an array of 6 pin numbers for that digit. So, turn off all of the LEDs for that digit and zero a counter. Select a random number between 0 and 5 and test whether that LED is already turned on using digitalRead(). If not then turn it on and increment the counter. Keep going until the counter equals the value for that digit, ie 4

first, thanks for donating your time to help a stranger.
second i only just realised i made a mistake by not conveying the fact that im using addressable leds(ws2812) and the neopixel library

i have however had a shower and got back into it

i now have the array thing mostly done and functioning … just need to find a way to select random unique pins from each array… at the moment it frequently spits out the same pins multiple times

#include <TimeLib.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
int digit1;
int digit2;
int digit3;
int digit4;
#include <NeoPixelBus.h>
const uint16_t PixelCount = 27; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 128
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
const byte houra [] = {26, 25, 24};
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
const byte mina [] = {14, 13, 12, 11, 10, 9};
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

void setup() {
 Serial.begin(9600);
     // this resets all the neopixels to an off state
    strip.Begin();
    strip.Show();
 setSyncProvider(RTC.get);// the function to get the time from the RTC
if(timeStatus()!= timeSet) {
 Serial.println("Unable to sync with the RTC");
 }
 else{
 Serial.println("Time retrieved from rtc"); 
 delay(200);
 delay(200);
 }
}
void loop() {
displayTime();

}
void displayTime()
{
         for (int i=0; i <= PixelCount-1; i++){    // set all to 0
strip.SetPixelColor(i, black);
strip.Show();
}
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);
//create pin arrays with length set to digit number
byte digit1pins[digit1];      
byte digit2pins[digit2];
byte digit3pins[digit3];
byte digit4pins[digit4];

 for(int q = 0; q <= digit1-1; q++){    //loop through count of hour digit 1 
//setting hour pins  with random selection of hourdigitbank 1 pins 
 digit1pins[q] = {houra[random(0, 2)]}; 
 }
   Serial.println(" "); 
  Serial.print("digit1pinscount:");
      Serial.print(digit1);
                Serial.println(" ");
      Serial.print("digit1pinsValue:");
 for(int q = 0; q <= digit1-1; q++){
       for (int i=0; i <= digit1-1; i++){    // set all to 0
strip.SetPixelColor(digit1pins[q], red);
}
    Serial.print(digit1pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit2-1; q++){    //loop through count of hour digit 2 
//setting hour pins  with random selection of hourdigitbank 2 pins 
 digit2pins[q] = {hourb[random(0, 8)]};
 }
 Serial.println(" "); 
  Serial.print("digit2pinscount:");
      Serial.print(digit2);
                Serial.println(" ");
      Serial.print("digit2pinsValue:");
 for(int q = 0; q <= digit2-1; q++){
       for (int i=0; i <= digit2-1; i++){    // set all to 0
strip.SetPixelColor(digit2pins[q], green);
}
    Serial.print(digit2pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit3-1; q++){    //loop through count of minute digit 1 
//setting minute pins  with random selection of minutedigitbank 1 pins 
 digit3pins[q] = {mina[random(0, 5)]};
 }
 Serial.println(" "); 
  Serial.print("digit3pinscount:");
      Serial.print(digit3);
                Serial.println(" ");
      Serial.print("digit3pinsValue:");
 for(int q = 0; q <= digit3-1; q++){
       for (int i=0; i <= digit3-1; i++){    // set all to 0
strip.SetPixelColor(digit3pins[q], blue);
}
    Serial.print(digit3pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
   for(int q = 0; q <= digit4-1; q++){   //loop through count of minute digit 2 
//setting minute pins  with random selection of minutedigitbank 2 pins 
 digit4pins[q] = {minb[random(0, 8)]};
 }
 Serial.println(" "); 
  Serial.print("digit4pinscount:");
      Serial.print(digit4);
                Serial.println(" ");
      Serial.print("digit4pinsValue:");
 for(int q = 0; q <= digit4-1; q++){
       for (int i=0; i <= digit4-1; i++){    // set all to 0
strip.SetPixelColor(digit4pins[q], red);
}
    Serial.print(digit4pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
strip.Show();
  delay(5000);
}

  for(int q = 0; q <= digit2-1; q++){    //loop through count of hour digit 2 You cannot use a for loop as the same LED pin may be chosen twice. You need to test whether the pin has already been chosen

not to sure how to go about inserting the values...
lol the best i can come up with is creating a temporary array to use as a "used pin" checker looping untill a counter equals the digitcount?

Check whether the chosen LED is already on by using digital read() and turn it on if not. No need to save the values.

i might be confusing with my use of the word pins...
the neopixel library lets you run addressable led's ... meaning i am controlling 27 led's with 2 power wires and one data wire with a 8khz signal
hence i can run strip.SetPixelColor(1, red); and it turns led 1 on and sets the color to red
or strip.SetPixelColor(25, green); and pin 25 turns green

so you don't care which leds are lit to tell you the hour and min, just that if it is 15:23 there are 1, 5 2 and 3 led lit respectively?

and the colors are then chosen from a random lot of colors, but you do or don't want to allow successive "digits" to be the same color?

almost…
it loops running displaytime function
displaytime function sets 4 digit vars to the 4 digits of time
each digit var represents a bank of leds …
so if i have a bank of 9 led’s and the digit for that bank is 6 i want to supply the command that controls the leds with a random selection of 6 out of the 9 led’s but uniquely

so the following code

for(int q = 0; q <= digit4-1; q++){   //loop through count of minute digit 2 

//setting minute pins  with random selection of minutedigitbank 2 pins 
 digit4pins[q] = {minb[random(0, 8)]};
 
}

when the second minute digit is say 6
will output 6 random values from the array minb()

const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

in its current form that could be 4, 6, 0, 5, 1, 8
but can also be 2, 2, 6, 1, 7, 7
now when it outputs duplicate numbers it tries to turn the same led on twice… if that last list of numbers is selected only lights 2, 6, 1 and 7 come on … ruining the clock by showing 4 lights instead of 6

Spl1nt3rm4n:
almost…

you’ve explained your code but not nailing what you want the program to do…

Here is a stab at filling a boolean array with true or false depending on the time. It will randomly select which LEDs are lit amongst the group of 3, 9, 6, and 9 respectively.

I’ve accelerated the clock by using minutes and seconds, but you should be able to adapt this for your needs…

this prints to Serial… it will give you a visual representation of which LEDs will lite.

You will have to take the array of ON/OFF values and use that to display your LEDs. You also have to add in your clock bits…

#include <NeoPixelBus.h>
#include <TimeLib.h>


const uint16_t PixelCount = 4; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266

#define colorSaturation 128

NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);

union Clock{
  struct{
    bool hourTens [3];
    bool hourOnes [9];
    bool minuteTens [6];
    bool minuteOnes [9];
  };
  bool ledArray[];
};

Clock clock;

void setup() 
{
  Serial.begin(9600);
  randomSeed(analogRead(A0));
}

void loop() 
{
  uint8_t currentHour = minute(); // hour();
  uint8_t currentMin = second();  // minute();
  digitize(clock, currentHour/10, currentHour%10, currentMin/10, currentMin%10);
  char currentTime[9];
  sprintf(currentTime, "%02d:%02d", currentHour, currentMin, second());
  Serial.println(currentTime);
  serialDisplayLeds();
  delay(1000);
}

void serialDisplayLeds()
{
  for (size_t i = 0; i < sizeof(clock); i++)
  {
    if(i == 3 or i == 12 or i == 18)
      Serial.print(" ");
    Serial.print(clock.ledArray[i] == true ? "1" : "0");
  }
  Serial.println();
}

void digitize(Clock& clk, uint8_t hourTens, uint8_t hourOnes, uint8_t minuteTens, uint8_t minuteOnes)
{
  fillDigit(hourTens, clk.hourTens, sizeof(clk.hourTens));
  fillDigit(hourOnes, clk.hourOnes, sizeof(clk.hourOnes));
  fillDigit(minuteTens, clk.minuteTens, sizeof(clk.minuteTens));
  fillDigit(minuteOnes, clk.minuteOnes, sizeof(clk.minuteOnes));
}

void fillDigit(uint8_t num, bool* array, size_t size)
{
  bool newArray[size];
  for(size_t i = 0; i < size; i++) // fill an array with number of leds lit
  {
    if (i < num)
      newArray[i] = true;
    else
      newArray[i] = false;
  }
  for(size_t i = 0; i < size; i++) // randomize the array
  {
    uint8_t r = random(i, size);
    bool temp = newArray[i];
    newArray[i] = newArray[r];
    newArray[r] = temp;
  }
  for(size_t i = 0; i < size; i++) 
  {
    array[i] = newArray[i];
  }
}

when the second minute digit is say 6
will output 6 random values from the array minb()

As I have said before, if you use a for loop you cannot guarantee that the same pin number is not chosen twice,

Look at this example that gets round that problem

const byte digitPins[] = {7, 8, 9, 10, 11, 12, 13};
const byte numberOfPins = sizeof(digitPins);
byte pinCount = 0;
byte digitValue;
byte randomPin;

void setup()
{
  Serial.begin(115200);
  for (int pin = 0; pin < numberOfPins; pin++)
  {
    pinMode(digitPins[pin], OUTPUT);
  }
}

void loop()
{
  clearAll();
  digitValue = random(1, numberOfPins);
  Serial.print("Digit value : ");
  Serial.print(digitValue);
  Serial.print("\t");
  choosePins();
  Serial.println();
  delay(1000);
}

void choosePins()
{
  Serial.print("\tpins chosen :\t");
  while (pinCount < digitValue)
  {
    randomPin = random(0, numberOfPins);
    if (digitalRead(digitPins[randomPin]) == HIGH)
    {
      digitalWrite(digitPins[randomPin], LOW);
      pinCount++;
      Serial.print(digitPins[randomPin]);
      Serial.print("\t");
    }
  }
}

void clearAll()
{
  for (int pin = 0; pin < numberOfPins; pin++)
  {
    digitalWrite(digitPins[pin], HIGH);
  }
  pinCount = 0;
}

Even better would be to put the pin numbers in a 2 dimensional array and write a function to accept the digit number, the number of LEDs to light and the number of pin numbers to choose from.

sorry for being a pain in the butt guys

this video shows how the clock operates

thanks uk heli for trying to help me but i feel my poor choice of words (ledpins) which is leftover from an old design idea,
has failed to communicate what i am doing

these leds are connected to my arduino via 3 wires total ... all 27 led's.
vcc gnd and data
the library controls them by sending a data signal to the strips.... each chip takes info from the data line and passes on the remaining info for the other led's
you can not read a pin state because its not a digital on/off setup .... when i pass the strip.setpixelcolor command the library generates an 8khz signal and outputs it to the one and only digital output pin that all the led's are connected to in series

here is a video of the leds with a demo program configured how i will eventually use them.

bulldog,
lol looking through that made my head hurt again :)(my programming skills are a mash up of copy/paste and limited reverse engineering)..
however i do see the randomness in the serial monitor ... this looks like a far better approach... ill set about integrating it with my needs tomorrow.
i have not had an indepth look at your code yet ... but if i can change the true/false to sets of red/black green/black and blue/black i think i can make it work
thanks again mate ill get back with my results after work

Spl1nt3rm4n:
bulldog,
lol looking through that made my head hurt again :)(my programming skills are a mash up of copy/paste and limited reverse engineering)..
however i do see the randomness in the serial monitor ... this looks like a far better approach... ill set about integrating it with my needs tomorrow.
i have not had an indepth look at your code yet ... but if i can change the true/false to sets of red/black green/black and blue/black i think i can make it work
thanks again mate ill get back with my results after work

I've not used your particular library, but I can probably help you use the true/false array to set the colors in your device. If I get a few moments, I may try that for you.

Why are there two types of colors I wonder?

RgbColor black(0);
HslColor hslRed(red);

these leds are connected to my arduino via 3 wires total ... all 27 led's.
vcc gnd and data
the library controls them by sending a data signal to the strips.... each chip takes info from the data line and passes on the remaining info for the other led's
you can not read a pin state because its not a digital on/off setup .... when i pass the strip.setpixelcolor command the library generates an 8khz signal and outputs it to the one and only digital output pin that all the led's are connected to in series

Sure, I get that, but the example was to show you how to get round the problem of choosing the same LED twice. Are you sure that the library does not have a method to read the colour of a pixel ? The Adafruit library certainly does.

something like this:

#include <NeoPixelBus.h>
#include <TimeLib.h>

const uint16_t PixelCount = 27;
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266

#define colorSaturation 128

RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);

RgbColor colorChoices[] = {
  red,
  green,
  blue,
  white,
};

union Clock {
  struct {
    bool hourTens [3];
    bool hourOnes [9];
    bool minuteTens [6];
    bool minuteOnes [9];
  };
  bool ledArray[];
};

Clock clock;

NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(sizeof(clock), PixelPin);

void setup()
{
  Serial.begin(9600);
  randomSeed(analogRead(A0));
}

void loop()
{
  uint8_t currentHour = minute(); // hour();
  uint8_t currentMin = second();  // minute();
  digitize(clock, currentHour / 10, currentHour % 10, currentMin / 10, currentMin % 10);
  char currentTime[6];
  sprintf(currentTime, "%02d:%02d", currentHour, currentMin);
  Serial.println(currentTime);
  serialDisplayLeds();
  setLedStrip();
  delay(1000);
}

void setLedStrip()
{
  int color = random(sizeof(colorChoices) / sizeof(colorChoices[0]));
  for (size_t i = 0; i < sizeof(clock); i++)
  {
    if (i == 3 or i == 12 or i == 18)
    {
      color = random(sizeof(colorChoices) / sizeof(colorChoices[0]));
    }
    clock.ledArray[i] ? strip.SetPixelColor(i, colorChoices[color]) : strip.SetPixelColor(i, black);
  }
  strip.Show();
}

void serialDisplayLeds()
{
  for (size_t i = 0; i < sizeof(clock); i++)
  {
    if (i == 3 or i == 12 or i == 18)
      Serial.print(" ");
    Serial.print(clock.ledArray[i] == true ? "1" : "0");
  }
  Serial.println();
}

void digitize(Clock& clk, uint8_t hourTens, uint8_t hourOnes, uint8_t minuteTens, uint8_t minuteOnes)
{
  fillDigit(hourTens, clk.hourTens, sizeof(clk.hourTens));
  fillDigit(hourOnes, clk.hourOnes, sizeof(clk.hourOnes));
  fillDigit(minuteTens, clk.minuteTens, sizeof(clk.minuteTens));
  fillDigit(minuteOnes, clk.minuteOnes, sizeof(clk.minuteOnes));
}

void fillDigit(uint8_t num, bool* array, size_t size)
{
  bool newArray[size];
  for (size_t i = 0; i < size; i++) // fill an array with number of leds lit
  {
    if (i < num)
      newArray[i] = true;
    else
      newArray[i] = false;
  }
  for (size_t i = 0; i < size; i++) // randomize the array
  {
    uint8_t r = random(i, size);
    bool temp = newArray[i];
    newArray[i] = newArray[r];
    newArray[r] = temp;
  }
  for (size_t i = 0; i < size; i++) // randomize the array
  {
    array[i] = newArray[i];
  }
}
  uint8_t currentHour = minute(); // hour();
  uint8_t currentMin = second();  // minute();

I am really not sure to make of this !

UKHeliBob:

  uint8_t currentHour = minute(); // hour();

uint8_t currentMin = second();  // minute();



I am really not sure to make of this !

Well, you’d have to read what I posted, I guess.

BulldogLowell:
I’ve accelerated the clock by using minutes and seconds, but you should be able to adapt this for your needs…

i think you may be right ukheli i think my library is based off the adafruit library.
but i ran into a lack of brain power when trying to read rgbvalues i think it outputs.

thnx for the help bulldog … i still think im not quite getting what i want from that … but i plowed ahead and got pretty close to what i want i think by defining a temporary pinbank array at the start of the loop function and as i copy a pinnumber setting that pin number to a known string and a quick check for said string when setting the value… which steps back in the loop to get another random value

#include <TimeLib.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
int digit1;
int digit2;
int digit3;
int digit4;
#include <NeoPixelBus.h>
const uint16_t PixelCount = 27; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 128
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
const byte houra [] = {26, 25, 24};
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
const byte mina [] = {14, 13, 12, 11, 10, 9};
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

void setup() {
 Serial.begin(9600);
     // this resets all the neopixels to an off state
    strip.Begin();
    strip.Show();
 setSyncProvider(RTC.get);// the function to get the time from the RTC
if(timeStatus()!= timeSet) {
 Serial.println("Unable to sync with the RTC");
 }
 else{
 Serial.println("Time retrieved from rtc"); 
 delay(200);
 delay(200);
 }
}
void loop() {
displayTime();

}
void displayTime()
{
byte thoura [] = {26, 25, 24};
byte thourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
byte tmina [] = {14, 13, 12, 11, 10, 9};
byte tminb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

         for (int i=0; i <= PixelCount-1; i++){    // set all to 0
strip.SetPixelColor(i, black);
strip.Show();
}
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);
//create pin arrays with length set to digit number
byte digit1pins[digit1];      
byte digit2pins[digit2];
byte digit3pins[digit3];
byte digit4pins[digit4];

 for(int q = 0; q <= digit1-1; q++){    //loop through count of hour digit 1 
//setting hour pins  with random selection of hourdigitbank 1 pins 

int currv = random(0, 2);

byte  curr = {thoura[currv]};
 if (curr == "ret"){
  q--;
 
}
 else{

   digit1pins[q] = curr;
   thoura[currv] = "ret";
 }
 }
   Serial.println(" "); 
  Serial.print("digit1pinscount:");
      Serial.print(digit1);
                Serial.println(" ");
      Serial.print("digit1pinsValue:");
 for(int q = 0; q <= digit1-1; q++){
       for (int i=0; i <= digit1-1; i++){    // set all to 0
strip.SetPixelColor(digit1pins[q], red);
}
    Serial.print(digit1pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit2-1; q++){    //loop through count of hour digit 2 
//setting hour pins  with random selection of hourdigitbank 2 pins 

 int currv = random(0, 8);

byte  curr = {thourb[currv]};
 if (curr == "ret"){
  q--;
 
}
 else{

   digit2pins[q] = curr;
   thourb[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};
 }
 Serial.println(" "); 
  Serial.print("digit2pinscount:");
      Serial.print(digit2);
                Serial.println(" ");
      Serial.print("digit2pinsValue:");
 for(int q = 0; q <= digit2-1; q++){
       for (int i=0; i <= digit2-1; i++){    // set all to 0
strip.SetPixelColor(digit2pins[q], green);
}
    Serial.print(digit2pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit3-1; q++){    //loop through count of minute digit 1 
//setting minute pins  with random selection of minutedigitbank 1 pins 

 int currv = random(0, 5);

byte  curr = {tmina[currv]};
 if (curr == "ret"){
  q--;
 
}
 else{

   digit3pins[q] = curr;
   tmina[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};


// digit3pins[q] = {mina[random(0, 5)]};
 }
 Serial.println(" "); 
  Serial.print("digit3pinscount:");
      Serial.print(digit3);
                Serial.println(" ");
      Serial.print("digit3pinsValue:");
 for(int q = 0; q <= digit3-1; q++){
       for (int i=0; i <= digit3-1; i++){    // set all to 0
strip.SetPixelColor(digit3pins[q], blue);
}
    Serial.print(digit3pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");

      
   for(int q = 0; q <= digit4-1; q++){   //loop through count of minute digit 2 
    
//setting minute pins  with random selection of minutedigitbank 2 pins 

 int currv = random(0, 8);

byte  curr = {tminb[currv]};
 if (curr == "ret"){
  q--;
  Serial.println(" "); 
  Serial.print("dupe:");
      Serial.print(currv);
       Serial.println(" "); 
}
 else{

   digit4pins[q] = curr;
    Serial.println(" "); 
  Serial.print("accepted  currv:");
      Serial.print(currv);
       Serial.println(" "); 
   tminb[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};



 //digit4pins[q] = {minb[random(0, 8)]};
 
 }

 
 Serial.println(" "); 
  Serial.print("digit4pinscount:");
      Serial.print(digit4);
                Serial.println(" ");
      Serial.print("digit4pinsValue:");

      
 for(int q = 0; q <= digit4-1; q++){
  
       for (int i=0; i <= digit4-1; i++){ // set all to 0

        
strip.SetPixelColor(digit4pins[q], red);
}
    Serial.print(digit4pins[q]);
    
        Serial.print(", "); 
        
 }


 
      Serial.println(" ");
strip.Show();
  delay(5000);
}

this outputs

accepted  currv:4 
 
accepted  currv:0 
 
accepted  currv:0 
 
accepted  currv:7 
 
accepted  currv:3 
 
accepted  currv:1 
 
accepted  currv:6 
 
accepted  currv:2 
 
accepted  currv:3 
 
digit4pinscount:9 
digit4pinsValue:4, 8, 134, 1, 5, 7, 2, 6, 134,  
 
digit1pinscount:1 
digit1pinsValue:25,  
 
digit2pinscount:5 
digit2pinsValue:23, 19, 16, 21, 134,  
 
digit3pinscount:5 
digit3pinsValue:12, 14, 13, 11, 10,  
 
accepted  currv:5 
 
accepted  currv:1 
 
accepted  currv:3 
 
accepted  currv:1 
 
accepted  currv:2 
 
accepted  currv:6 
 
accepted  currv:3 
 
accepted  currv:0 
 
accepted  currv:1 
 
digit4pinscount:9 
digit4pinsValue:3, 7, 5, 134, 6, 2, 134, 8, 134,

this is 90% there to what i need i believe … but i have made a mistake somewhere… it is generating weird values occasionally
correction… it is outputting 134 randomly(not in the array) … tells me im doing some simple mistake and trying to output text or something as one of the digits?

well i got that sorted
changed my check dupe to check for anything higher than 27 … works like a charm now… will upload a video of the completed thing when i can

#include <TimeLib.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
int digit1;
int digit2;
int digit3;
int digit4;
#include <NeoPixelBus.h>
const uint16_t PixelCount = 27; // this example assumes 4 pixels, making it smaller will cause a failure
const uint8_t PixelPin = 2;  // make sure to set this to the correct pin, ignored for Esp8266
#define colorSaturation 128
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin);
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
HslColor hslRed(red);
HslColor hslGreen(green);
HslColor hslBlue(blue);
HslColor hslWhite(white);
HslColor hslBlack(black);
const byte houra [] = {26, 25, 24};
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
const byte mina [] = {14, 13, 12, 11, 10, 9};
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

void setup() {
 Serial.begin(9600);
     // this resets all the neopixels to an off state
    strip.Begin();
    strip.Show();
 setSyncProvider(RTC.get);// the function to get the time from the RTC
if(timeStatus()!= timeSet) {
 Serial.println("Unable to sync with the RTC");
 }
 else{
 Serial.println("Time retrieved from rtc"); 
 delay(200);
 delay(200);
 }
}
void loop() {
displayTime();

}
void displayTime()
{
  int dupe1 = 0;
    int dupe2 = 0;
      int dupe3 = 0;
        int dupe4 = 0;
byte thoura [] = {26, 25, 24};
byte thourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
byte tmina [] = {14, 13, 12, 11, 10, 9};
byte tminb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};

         for (int i=0; i <= PixelCount-1; i++){    // set all to 0
strip.SetPixelColor(i, black);
strip.Show();
}
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);
//create pin arrays with length set to digit number
byte digit1pins[digit1];      
byte digit2pins[digit2];
byte digit3pins[digit3];
byte digit4pins[digit4];

 for(int q = 0; q <= digit1-1; q++){    //loop through count of hour digit 1 
//setting hour pins  with random selection of hourdigitbank 1 pins 

int currv = random(0, 3);

byte  curr = {thoura[currv]};
 if (curr > 26){
  dupe1 ++;
  q--;
 
}
 else{

   digit1pins[q] = curr;
   thoura[currv] = "ret";
 }
 }
   Serial.println(" "); 
  Serial.print("digit1pinscount:");
      Serial.print(digit1);
                Serial.println(" ");
      Serial.print("digit1pinsValue:");
 for(int q = 0; q <= digit1-1; q++){
       for (int i=0; i <= digit1-1; i++){    // set all to 0
strip.SetPixelColor(digit1pins[q], red);
}
    Serial.print(digit1pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit2-1; q++){    //loop through count of hour digit 2 
//setting hour pins  with random selection of hourdigitbank 2 pins 

 int currv = random(0, 9);

byte  curr = {thourb[currv]};
 if (curr > 26){
    dupe2 ++;
  q--;
 
}
 else{

   digit2pins[q] = curr;
   thourb[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};
 }
 Serial.println(" "); 
  Serial.print("digit2pinscount:");
      Serial.print(digit2);
                Serial.println(" ");
      Serial.print("digit2pinsValue:");
 for(int q = 0; q <= digit2-1; q++){
       for (int i=0; i <= digit2-1; i++){    // set all to 0
strip.SetPixelColor(digit2pins[q], green);
}
    Serial.print(digit2pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");
  for(int q = 0; q <= digit3-1; q++){    //loop through count of minute digit 1 
//setting minute pins  with random selection of minutedigitbank 1 pins 

 int currv = random(0, 6);

byte  curr = {tmina[currv]};
 if (curr > 26){
    dupe3 ++;
  q--;
 
}
 else{

   digit3pins[q] = curr;
   tmina[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};


// digit3pins[q] = {mina[random(0, 5)]};
 }
 Serial.println(" "); 
  Serial.print("digit3pinscount:");
      Serial.print(digit3);
                Serial.println(" ");
      Serial.print("digit3pinsValue:");
 for(int q = 0; q <= digit3-1; q++){
       for (int i=0; i <= digit3-1; i++){    // set all to 0
strip.SetPixelColor(digit3pins[q], blue);
}
    Serial.print(digit3pins[q]);
        Serial.print(", "); 
 }
      Serial.println(" ");

      
   for(int q = 0; q <= digit4-1; q++){   //loop through count of minute digit 2 
    
//setting minute pins  with random selection of minutedigitbank 2 pins 

 int currv = random(0, 9);

byte  curr = {tminb[currv]};
 if (curr > 26){
    dupe4 ++;

       q--;
}
 else{

   digit4pins[q] = curr;

       
   tminb[currv] = "ret";
 }
 
 //digit2pins[q] = {hourb[random(0, 8)]};



 //digit4pins[q] = {minb[random(0, 8)]};
 
 }

 
 Serial.println(" "); 
  Serial.print("digit4pinscount:");
      Serial.print(digit4);
                Serial.println(" ");
      Serial.print("digit4pinsValue:");

      
 for(int q = 0; q <= digit4-1; q++){
  
       for (int i=0; i <= digit4-1; i++){ // set all to 0

        
strip.SetPixelColor(digit4pins[q], red);
}
    Serial.print(digit4pins[q]);
    
        Serial.print(", "); 
        
 }
                  Serial.println("");
      Serial.print("dupes:");
            Serial.print(dupe1);
                  Serial.print(", ");
            Serial.print(dupe2);
                  Serial.print(", ");
            Serial.print(dupe3);
                  Serial.print(", ");
            Serial.print(dupe4);
                  Serial.println("");


                  
       Serial.println(" ");
      Serial.println(" ");
strip.Show();
  delay(5000);
}

here is my finished project

#include <TimeLib.h>
#include <Wire.h>
#include <DS1307RTC.h> // a basic DS1307 library that returns time as a time_t
// these values hold a single number ie the digit for hours and minutes
// ie (11:45pm) translates to each integer value containing 2345 
int digit1;
int digit2;
int digit3;
int digit4;
#include <NeoPixelBus.h>
const uint16_t PixelCount = 27; // set number of ws2812 led's in the chain
const uint8_t PixelPin = 2;  // defines data pin for led chain
#define colorSaturation 20  // defines brightness of led's
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(PixelCount, PixelPin); //set up neopixel with led type and xmit method
//define colors
RgbColor red(colorSaturation, 0, 0);
RgbColor green(0, colorSaturation, 0);
RgbColor blue(0, 0, colorSaturation);
RgbColor white(colorSaturation);
RgbColor black(0);
// led address are configured into arrays for 4 banks

const byte houra [] = {26, 25, 24};                           // first hour digit
const byte hourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};   // second hour digit
const byte mina [] = {14, 13, 12, 11, 10, 9};                 // first minute digit
const byte minb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};             // second minute digit
void setup() {
    Serial.begin(9600);
     // this resets all the neopixels to an off state
    strip.Begin();
    strip.Show();
 setSyncProvider(RTC.get);// the function to get the time from the RTC
if(timeStatus()!= timeSet) {
}
else{

  // ????? sketch fails if i remove all serial output
 Serial.println("Time retrieved from rtc"); 

 delay(200);
}
}
void loop() {
displayTime();
}
void displayTime()                          // convert time into led execution
{
                                            //  temporary array that stores the led addresses which will be overwritten with controlled data to eliminate duplicates
byte thoura [] = {26, 25, 24};
byte thourb [] = {23, 22, 21, 20, 19, 18, 17, 16, 15};
byte tmina [] = {14, 13, 12, 11, 10, 9};
byte tminb [] = {8, 7, 6, 5, 4, 3, 2, 1, 0};
// clear led states from last run
for (int i=0; i <= PixelCount-1; i++)
    {    // set all to 0
     strip.SetPixelColor(i, black);
     strip.Show();
    }
                                            // assign current time into digit variables
digit1 = (hour() /10) %10;
digit2 = (hour() %10);
digit3 = (minute() /10) %10;
digit4 = (minute() %10);

                                            //create pin arrays with length set to digit number
byte digit1pins[digit1];      
byte digit2pins[digit2];
byte digit3pins[digit3];
byte digit4pins[digit4];

 for(int q = 0; q <= digit1-1; q++)         //loop through count of hour digit 1 
      {  
                                            //setting hour pins  with random selection of hourdigitbank 1 pins 
      int currv = random(0, 3);             //pick a random number
      byte  curr = {thoura[currv]};     
      if (curr > 26)                        //check if its unique
          {
          q--;                              //duplicate found ... rerun iteration of loop
          }
 else{
   digit1pins[q] = curr;                    //unique number
   thoura[currv] = "ret";                   //remove it from array
 }
 }
 for(int q = 0; q <= digit1-1; q++){        //loop through digit count

  
       for (int i=0; i <= digit1-1; i++){    
strip.SetPixelColor(digit1pins[q], red);    //this is first hour digit... setting to red
}


                                    }
  for(int q = 0; q <= digit2-1; q++)        //loop through count of hour digit 2 
  {                                         //setting hour pins  with random selection of hourdigitbank 2 pins 

 int currv = random(0, 9);
byte  curr = {thourb[currv]};
if(curr > 26){
q--;
}
else{
digit2pins[q] = curr;
thourb[currv] = "ret";
}
}
for(int q = 0; q <= digit2-1; q++){
for(int i=0; i <= digit2-1; i++){
strip.SetPixelColor(digit2pins[q], green);  //this is second hour digit... setting to green
}
}
for(int q = 0; q <= digit3-1; q++){    
int currv = random(0, 6);
byte curr = {tmina[currv]};
if(curr > 26){
q--;
}
else{
digit3pins[q] = curr;
tmina[currv] = "ret";
}
}
for(int q = 0; q <= digit3-1; q++){
for (int i=0; i <= digit3-1; i++){
strip.SetPixelColor(digit3pins[q], blue);//this is first minute digit... setting to blue
}
}
for(int q = 0; q <= digit4-1; q++){
int currv = random(0, 9);
byte  curr = {tminb[currv]};
if(curr > 26){
q--;
}
else{
digit4pins[q] = curr;
tminb[currv] = "ret";
}
}
for(int q = 0; q <= digit4-1; q++){
for(int i=0; i <= digit4-1; i++){
strip.SetPixelColor(digit4pins[q], red);//this is second minute digit... setting to red
}
}
strip.Show();
delay(15000);
}