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: 

generate random number

Solved!
Go to solution

Thanks for the tip! but I'm using a recent version of Labview and this doesn't work unfortenately 

0 Kudos
Message 11 of 19
(2,296 Views)
Solution
Accepted by topic author Chris257

Then you should be able to implement the VI on your own following what you see.

At least this part can be useful to learn about the LV palettes instead of receiving a ready-to-use homework with no real learn effect.

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 12 of 19
(2,288 Views)

Actually the case structure is completely superfluous!

Here's a  simplified version:

ran.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 13 of 19
(2,265 Views)

If you have a recent version of LV, then it should work fine.  The most recent version is 2016, which is the version I used to create the snippet.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 14 of 19
(2,261 Views)

Depending on your browser, you may need to drag and drop to your desktop first.  Then drag and drop that file to the block diagram.  Firefox is one browser I know of that does not allow direct drag and drop from browser to block diagram.

0 Kudos
Message 15 of 19
(2,242 Views)

@BowenM wrote:

@crossrulz wrote:

One simple solution would be to use the Ramp function to create an array of numbers from 0 to 10 and then the Riffle function.


Assuming this actually is a homework problem... that would be a very interesting solution.  If someone handed that to me I don't know if I'd be mad because they obviously didn't do the assignment as I intended, or impressed that they came up with the workaround


And I would give it an A+.  The problem is essentially "Shuffle the deck" (where here "deck" has only Ace of spades through the 10 of spades).  I'm curious how the Riffle function works -- there is a known "most optimum" method of randomly ordering a set of size N (10, in this case).  Famous Darren presented a fascinating talk a few years ago where he presented the "Texas Lottery Problem", namely drawing N lottery balls from a set of M (maybe 5 from 52?  I don't remember).  He presented 3-4 ways to do it, had the audience "vote" on which would be fastest, and almost all of us (including me) were wrong.  But I raised my hand and said "But I can do it even faster using the correct Shuffle Algorithm" -- fortunately, I turned out to be right, but not by much ...

 

Bob Schor

0 Kudos
Message 16 of 19
(2,209 Views)

ran2.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 17 of 19
(2,189 Views)

something like this

0 Kudos
Message 18 of 19
(2,187 Views)

Thanks! That's simply brilliant.

 

Random in range.png

0 Kudos
Message 19 of 19
(1,362 Views)