LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView Help

I have to create a program that simulates a lottery generator. The Numbers have to be 1-69 and the numbers cannot show up more than once. Please help

 

PLEASE HELP.... i know you guys are seeing this

0 Kudos
Message 1 of 30
(4,782 Views)

First read this.

 

http://www.catb.org/esr/faqs/smart-questions.html

 

Second, come up with a better subject for your message.  This is a LabVIEW forum.  Everyone on here is asking for help about LabVIEW.

 

Third, show what you have done so far.  We can't help you when you haven't posted any code.

 

That reminds me.  I need to call my mechanic to help me fix my car.  I won't tell him what is wrong.  I won't bring it in.  I'll just ask him to troubleshoot it over the phone.  I'll tell him on the phone to "PLEASE HELP.... I know you can hear me"

 

Fourth, is this homework?  It sure sounds like it is.  No one is going to give a solution to you.  If you are smart enough, you can search the forums and probably find the answer.  But make sure you understand how it works.  It would look bad to your instructor if you turned in an assignment and you weren't able to tell him how you arrived at your solution.

Message 2 of 30
(4,747 Views)

Well since My teacher just gave us this assigment without telling us anything before hand. so i had no idea what to say , this is why i came here

0 Kudos
Message 3 of 30
(4,741 Views)

Then go back to your teacher and ask questions.

 

Have you ever touched LabVIEW before?  If you are a "self-starter", start by looking at some tutorials.

 

 How to Learn LV

0 Kudos
Message 4 of 30
(4,732 Views)

Yes i have, i've used it a few times. I have basic knowledeg of arrays, case structures and numeric things. Thats about it. 

I have one of those teachers that expects us to learn everything on our own so even if i did ask him questions he wouldn't help me. 

0 Kudos
Message 5 of 30
(4,720 Views)

Before you touch LabVIEW, put down on paper exactly how you would do it as a form of pseudocode.

 

You'll certainly need a loop.  You will need a random number generator which provides a number n where 0<= n < 1.  (It's in the palettes).  You will need to do some basic math to convert that to 1 to 69.  Be sure you understand what a shift register is  in LabVIEW, I'm sure you'll need to use one or two of them.

 

With basic knowledge of arrays, you should be able to write the pseudocode, then it won't be that hard to convert to LabVIEW code.

0 Kudos
Message 6 of 30
(4,704 Views)

Thanks and one last thing. When i run the program a number can not be repeated. How do i preven that?

0 Kudos
Message 7 of 30
(4,699 Views)

Keep an array that tells you what numbers have already been picked.  If you pick that number again, then repeat the random number until you don't.  (That is where a shift register will come in handy.)

0 Kudos
Message 8 of 30
(4,689 Views)

The way I would do this that's pretty simple is this:

  1. Build array of 1-69
  2. Use a For loop to loop N times for how many numbers you want to pull out
  3. Pass your array to shift registers on the For loop
  4. Within the For loop, use random number (scaled to be between 0 and array size minus 1) to delete an element from the array and pass the smaller array back to the shift register
  5. Output the deleted elements from each loop of the array and you have your lotterty numbers.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


0 Kudos
Message 9 of 30
(4,620 Views)

@RavensFan wrote:

First read this.

 

http://www.catb.org/esr/faqs/smart-questions.html

 


 

That link is amazing, thank you RavensFan!

Message 10 of 30
(4,602 Views)