LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Randomize 2D Boolean Array

Solved!
Go to solution

I am trying to randomize a array of Boolean values and for what ever reason I have been unsuccessful

 

I have been successful in makine the rows random, but I want the whole array to be random

 

added to this I put a number to bool array.

 

thanks,

 

Message Edited by Harold Timmis on 08-15-2009 08:52 PM
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 1 of 9
(4,443 Views)
Solution
Accepted by topic author Harold_Timmis

The Initialize Array function will give you the same value for all elements. This is documented in the Help. Thus, you cannot use it this way. You can simply use two loops so you generate a random number for each element of your 2D array. I don't understand what you're saying about the Number to Boolean Array, or why you would even use that. If you use the 2-loop approach all you need to do is decide what you consider a "1". For example, you could say that anything greater than 0.5 is a "1". This can be done with a simple Greater? function. Note that this should be done inside the loop.

 

An alternative is to use the Continuous Random function to get an array of random numbers which you can reshape into a 2D array. You would need to decide if the distribution provided by that function is "random enough". 

 

Are you trying to create some sort of random communication signal?

Message 2 of 9
(4,426 Views)
I am just trying to make a 4X4X4 cube
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 3 of 9
(4,421 Views)

good lord I need to go to bed I complelty had a brain fart

 

thanks man for putting me straight

 

have a good night

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 4 of 9
(4,420 Views)

yes I want random 1's and 0's, but I want to than convert it to boolean variables (bool array) and right now I am having problems doing that for what ever reason

 

i tried to use the convert from number to bool array but it has not worked for me yet.

Message Edited by Harold Timmis on 08-15-2009 10:16 PM
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 5 of 9
(4,415 Views)
Don't round.  Just compare the number to >= 0.5.  It gives you a boolean!
Message 6 of 9
(4,410 Views)

thanks ravens fan,

 

I put too much thought into it

 

 

 

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 7 of 9
(4,404 Views)

Harold Timmis wrote:
I am just trying to make a 4X4X4 cube

try this...

Message 8 of 9
(4,380 Views)

Harold Timmis wrote:
I am just trying to make a 4X4X4 cube

A 4x4x4 array is a 3D array, not a 2D array. Smiley Wink

0 Kudos
Message 9 of 9
(4,359 Views)