Showing results for 
Search instead for 
Did you mean: 

Random Dice and Histograms

I am working on a new project that involves using the random number (0-1) and the random number (range) VIs to essentially roll dice and based on the number you can see the LEDs light up and depict what that number would look like on a D6 die, and I am doing this 


The issue that I am having is that I need to modify this project to where I have a new event in the event case and I can press a button and the dice will roll continuously or a specified number of times and each time we generate a number there will be a histogram with 6 buckets for each 1-6 number that will fill up until the user is done with it. 


This is trying to illustrate the probability question of the two random number VIs. 


Ignore the for loop in the roll continuously event and any parts that may seem wrong as I was playing around with this for a bit.

0 Kudos
Message 1 of 3

You need to start with some basic tutorials.


  • To could the various integer values, you can just keep an integer array in a shift register and increment each element if it occurs.
  • Nonr of your local variables are needed.
  • Never remove the label of terminals. Of you don't want to see them on the front panel, you can hide them.
  • There is a +1 primitive
  • Round to nearest will give you an unfair dice because the edge values will only have half the probability of the others.
  • You don't need to write the same code twice.
  • You can play with the timeout of you want to roll continuously.
  • etc.
0 Kudos
Message 2 of 3

See if this can give you some ideas. (It is always good to pad on each side to watch for out of range values (0, or 7), just to be sure they stay zero!






We know this is homework, so use my code to study and learn, then create you own. There are some traps that will tell your teacher that it is not your code.


(You also need to know about cluster ordering for example, etc.)



Message 3 of 3