LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random String Generation from a RegEX

Solved!
Go to solution

Well, a brief summary of what I need to do.

I need to generate a range of addresses (comprised of eight bytes) and I made a RegEx to verify if it's a valid address.

Is there anyway, thru LabVIEW, I can generate a random string from the said RegEx?

0 Kudos
Message 1 of 6
(1,524 Views)

Hi kagaoanjc,

 


@kagaoanjc wrote:

I need to generate a range of addresses (comprised of eight bytes) and I made a RegEx to verify if it's a valid address.
Is there anyway, thru LabVIEW, I can generate a random string from the said RegEx?


From what I know a RegEx is used to parse an already existing string, but not to create a new string.

 

To create a random string of 8 chars/bytes you just need a few nodes:

Mind to explain your specific rules?

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 6
(1,520 Views)

Well yeah, just wondering if there's a way, else I'd be using some libraries on the web and execute it on Python

The address is formatted the same way that of a MAC address (separated by colons)

first three bytes are already defined, then we were tasked to generate approx 1M addresses where X are the values we can change or play around with.

CC:CC:CC:00:00:2X:XX:XX

0 Kudos
Message 3 of 6
(1,497 Views)

Are you asking for how to generate an (or many) ip-address(es) randomly?

You could do this:

thols_0-1615541145239.png

 

The MAC-address format, how does it correlate to an ip-address? If the last 4 segments are ip-address in hex-format, then it should be easy, just format as hex:

thols_1-1615541398891.png

 

Certified LabVIEW Architect
0 Kudos
Message 4 of 6
(1,489 Views)
Solution
Accepted by topic author kagaoanjc

Hi kaga,

 


@kagaoanjc wrote:

first three bytes are already defined, then we were tasked to generate approx 1M addresses where X are the values we can change or play around with.
CC:CC:CC:00:00:2X:XX:XX


Your "approx 1M addresses" probably means exactly 2^20 possible values:

You just need to add some string formatting…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(1,480 Views)

Yeah roughly 1M devices will be produced

To make the story clearer, these "addresses" are the DevEUI of LoRA devices we're gonna produce, was overthinking on how to generate such that it satisfies their requirements and the format.

now that VI opened my mind that some solutions can be that simple. Thanks! Had initially thought of generating one at a time while the software checks if the unit is a fresh one or not (if not, it's gonna reuse the same DevEUI during flashing)

I now face the challenge of ensuring that each of these DevEUIs must be used once and if the DUT must be retested, my software must not get a DevEUI from the generated pool, but that's another story, I have a test database to tinker around with

0 Kudos
Message 6 of 6
(1,475 Views)