LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Random button array

Solved!
Go to solution

Hello

I have the ABC word's, each character one button. I have to create a random button array with 4,5,6..etc(variable) elements from these buttons. I have no idea whats the right way, how to creat these problem. 

Thank you for your reply.

0 Kudos
Message 1 of 12
(3,334 Views)

Use the Random Number inside of a FOR loop.  To get a range of values, the typical way to do it would be rand*range size+min number.  Since you are dealing with letters, you would want rand*26+0.  This would give you an array of indecies corresponding to the letters your want.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(3,306 Views)
...but if you add an offset of 64 to the multiplied random numbers the result you get will actually be the ASCII codes for the letters -- in upper case. If you want lower case add 97.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 3 of 12
(3,290 Views)

Thank you.I attached one jpg, i need to useable buttons. Primarily if i push one button add one letter to array. I try to create a wordsearch game. 

0 Kudos
Message 4 of 12
(3,273 Views)

Why all the unwired buttons?  It would be easier to have a single output of the event structure going into a single Build Array function.

 

Can you translate the sentence "I need to useable buttons" into English?

0 Kudos
Message 5 of 12
(3,265 Views)

 

Please attach the VI instead of a blurry picture with most code hidden. What is the mechanical action of the buttons? If they are latch action, they belong inside their respective event case. Is there an event for the stop button?

 

Keep the array in a shift register and use build array to append an new element. No local variable or insert onto array needed. Whatever you are currently doing is highly comvoluted and overly complicated.

0 Kudos
Message 6 of 12
(3,252 Views)

Sorry for my horrible english. I wanted to say i need random letters as buttons.

0 Kudos
Message 7 of 12
(3,251 Views)
0 Kudos
Message 8 of 12
(3,242 Views)

@Blen86 wrote:

Sorry for my horrible english. I wanted to say i need random letters as buttons.


I still don't understand what that means. Can you show a picture?

A letter is not a button. Do you want buttons with random letters on them? How often should the letters change?

0 Kudos
Message 9 of 12
(3,237 Views)

Maybe this can give you some ideas.

 

 

Message 10 of 12
(3,220 Views)