08-15-2009 07:50 PM - edited 08-15-2009 07:52 PM
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,
Solved! Go to Solution.
08-15-2009 08:51 PM
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?
08-15-2009 09:02 PM
08-15-2009 09:06 PM
good lord I need to go to bed I complelty had a brain fart
thanks man for putting me straight
have a good night
08-15-2009 09:14 PM - edited 08-15-2009 09:16 PM
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.
08-15-2009 09:25 PM
08-15-2009 09:34 PM
thanks ravens fan,
I put too much thought into it
08-15-2009 11:32 PM
08-16-2009 09:49 AM
Harold Timmis wrote:
I am just trying to make a 4X4X4 cube
A 4x4x4 array is a 3D array, not a 2D array.