I am currently working on a project that randomly outputs either a "0" or "1" for 100 different time values. Each run of this corresponds to a "seed". I need to somehow code something that counts the number of consecutive 0's starting from a time point for each seed, and then prints it in a data table. If the seed being evaluated at a certain time starts with a 1, its sum is 0. From there, once all of these sums of consecutive 0's are found, I need to find its average (the average of zeroes before a 1 occurs). Attached below is the code I have so far (it only creates the seeds and time values).
Close All( Data Tables, No Save ); //Make the data table dt = New Table( "Case 1", Add Rows( 100 ), New Column( "Time", Set Formula( Sequence( 1, 100 ) ) ), New Column( "Seed 1", Numeric, "Continuous", Format( "Best", 10 ), Formula( Random Integer( 0, 1 ) ) ) );
For( i = 2, i < 101, i++, dt << New Column( "Seed " || Char( i ), Numeric, Continuous, Formula( Random Integer( 0, 1 ) ) ),