LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HELP WITH GENERATE RANDOM FLOATING NUMBER

Solved!
Go to solution

Create a VI to generate a random floating-point number between 0 and 1 every second and repeat for a finite number of iterations specified by the user. The VI will then return the largest number generated. An indicator will be used to count the number of iterations elapsed. 

 

Please help me to solve this. Thank you

0 Kudos
Message 1 of 13
(4,074 Views)

Lets see what you have so far...

Where are you getting stuck?

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 2 of 13
(4,064 Views)

Sounds like a homework problem. We're not here to do your homework, of course. But we can help you with specific problems you have with your attempt. Can you post your existing VI?

0 Kudos
Message 3 of 13
(4,058 Views)

Hint: use a FOR loop.  Use a Shift Register to hold the largest value.  I'll let you figure out the rest.


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 4 of 13
(4,037 Views)

Hi Atira,

 

you don't need a shift register as your requirement is to return the largest random number when the VI exits.

(The shift register will help you to reduce memory requirements while the VI runs, when the user chooses to run the VI for a larger number of iterations.)

 

With so many suggestions you should be able to solve your homework!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 13
(4,009 Views)

AtiraSuhaimi_0-1588781137566.png

Is this correct? I think this is so simple. Can I add something else?

 

0 Kudos
Message 6 of 13
(3,965 Views)

Is this correct? But I think this is so simple? I want to add something to look this not simple

AtiraSuhaimi_0-1588781433793.png

 

0 Kudos
Message 7 of 13
(3,960 Views)

What do you mean I don't need a shift register? So who should I use? 

0 Kudos
Message 8 of 13
(3,955 Views)
Solution
Accepted by topic author AtiraSuhaimi

You are close. Here are a few of the changes I would make.

 

Example.png

 

I would use the point by point max value. That is what you said that you were looking for. You can use the built in function to increment for the iteration count.

Tim
GHSP
0 Kudos
Message 9 of 13
(3,951 Views)

@AtiraSuhaimi wrote:

Is this correct? But I think this is so simple? I want to add something to look this not simple

 

 


Yep, that code does what you want and it's as simple as it needs to be. You can use the Pt-by-Pt VI to remember the max value if you want, but the shift register works just fine. You could also use an array to store ALL of the values, then get the max array value. Any of those work just fine.

 

Simple is good!

0 Kudos
Message 10 of 13
(3,941 Views)