From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I create a random number generator protected by password and user name?

Solved!
Go to solution
I attached a VI that is a random number generator. I just want to be prompted for user name/password when I start this generator. There should be three user names and passwords found in three different txt files. I would like to know how to link the user/password code to the number generator code and how to make the program to know that there are three txt files in my computer with the user names and passowrds.
0 Kudos
Message 1 of 28
(4,748 Views)
You will either have to hard code the three files (name and location), have all three files in the same directory and have LabVIEW list files in directory to get their names and act on them, or you can search every drive on your computer for specific file names or specific file extensions in order to locate the files and act on them.
0 Kudos
Message 2 of 28
(4,738 Views)

What you have is just a subVI.  It can act as a function as part of a larger application.  Or you can build the rest of the application around what you have now.

 

What does the random number have to do with the password or text files?

 

You should look at examples on File I/O VI's, and als user dialog VI's in the example finder to see how they work.  Then figure out how you can make them work together with whatever you have in mind for your application.

0 Kudos
Message 3 of 28
(4,733 Views)
It is just a homework and I am new at this. An attachment or an example would be most helpfull.
0 Kudos
Message 4 of 28
(4,728 Views)
What version of labview are you using?
0 Kudos
Message 5 of 28
(4,707 Views)

jmcbee wrote:
What version of labview are you using?

The attached VI is in 7.1.

Message 6 of 28
(4,703 Views)
I have 8.5 but that is from somewhere else. I don't think this should be a problem.
0 Kudos
Message 7 of 28
(4,700 Views)

Hmmm. this is homework and you're using 8.5 "from somewhere else".....

 

 

Hmmm....

0 Kudos
Message 8 of 28
(4,687 Views)

Well, you would create a password dialog. Open your example finder and look for the example "login dialog.vi". Maybe it can give you some ideas. 😄

 

 

In the meantime, you might want to cleanup your code a little bit. There is a primitive for 1/x and I am not sure why you do that double-division? Why not e.g. the following:

 

 

Both give you equally distributed random numbers over the desired interval (incl. boundaries).

 

 

Message Edited by altenbach on 03-12-2009 11:52 AM
Message 9 of 28
(4,684 Views)
Thanks for the tip @altenbach but how can I just include the example you just gave me (the random number generator) in the "login dialog.vi". I want to be promped for user/password and then I want to continue with the random generator providing the fact that the user/password were correct. BTW, where can I change the user/password and the number of users/passwords?
0 Kudos
Message 10 of 28
(4,656 Views)