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.
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.
04-05-2017 02:06 AM
How to generate a random number from 1 to 50 in array
04-05-2017 02:20 AM - edited 04-05-2017 02:20 AM
Hi raki,
no need to hijack old threads for your own question!
If you would search this forum you would find a lot of possible solutions as your question comes up quite often! (It's a typical task to let beginners learn LabVIEW features.)
generate a random number
There is a LabVIEW function giving you random numbers with 0 < x < 1 (according to LV2011 help).
from 1 to 50
You need some simple math to scale the number you already got…
in array
Usually you use loops to generate arrays…
04-05-2017 02:25 AM - edited 04-05-2017 02:31 AM
@raki7 wrote:
How to generate a random number from 1 to 50 in array
Please show the entire homework assignment. A lot of information seems missing.
Have you done a forum search? Plenty of solutions have been posted in the past.
* EDIT: I guess you did not write the subject line and it has little to do with your posts. It came from the thread you hijacked before the post got moved.
04-19-2017 01:07 AM
Hi GerdW
im using a random number function to generate numbers from 0 to 50, but im getting the repeated numbers in a array and as i run it multiple times, numbers gets changed. i wanna know how to remove the repeated numbers in the array. plz can you help me out with this..
04-19-2017 01:30 AM
04-19-2017 03:46 AM
Im using LV2016....
04-19-2017 03:53 AM
The simple solution is to create an array of 51 elements (data type does not matter so use a U8 for the smallest memory hit, also use Initialize Array) and then use Riffle.vi. Use the index array output. You will now have a random order of numbers from 0 to 50 with no duplicates. You can use Array Subset if you just need a certain number of values.
04-19-2017 05:05 AM
sorry... im new to labview can you please help me how to design it
04-19-2017 05:57 AM
@raki7 wrote:
sorry... im new to labview can you please help me how to design it
I gave you step-by-step instructions for 2 functions that you need. If you are unwilling to give it a try, I cannot help you. Or if you are just lost, go through some of the tutorials.
3 Hour Introduction
6 Hour Introduction
LabVEW Basics
Self Paced training for students
Self Paced training beginner to advanced, SSP Required
LabVIEW Wiki on Training
Learning NI
Getting Started with NI Products