Random table without sequential repetitions

Hello

Continue to build the practice of e-Learning (lots of help from kglad). Came across a problem with sequential repetitions in the table randomly, which need a solution. The AS3 script (a lot of help here from kglad) to generate and then mix the table, often (since there are only 9 potential elements for a length of array of 70) product of the sequential repetitions. For example, you use 1,2,3,4,5,6,7,8,9 as elements, the mixed final table may produce 2,2,2, 1,4,5,9,3.3...

Problem is that when these repetitions are used as textbox.text, there is no transition between same (repeated) "words." If a Word change (for example, 5-3), the user sees a visiable change. However, with these sequences repeated (for example, 02:57), there is no transition: repetition seems to remain the same for extended periods of time. Then, the user is not sure if they have already chosen this word.

In any case it would be preferable, since I can't add a visible transition for rehearsals, to simply avoid sequential repetitions, if possible. But can not find a way to add to the script.

Any help appreciated.

The scripts array and shuffle random current:

var index:int = 0;
var numToDisplay:int = 10;
var groupA:Array = ["1","2","3"]
var groupB:Array = ["4","5","6"]
var groupC:Array = ["7","8","9"]
var word_array:Array = [];
var i:int;
for(i=0;i<3;i++){
word_array.push(groupA[Math.floor(groupA.length*Math.random())]);
}
for(i=0;i<3;i++){
word_array.push(groupB[Math.floor(groupB.length*Math.random())]);
}
for(i=0;i<3;i++){
word_array.push(groupC[Math.floor(groupC.length*Math.random())]);
}

shuffle(word_array);

function shuffle(a:Array) {
        var i:int;
        var j:int;
        var e:*;
        var len:int = a.length;
        for (i = len-1; i>=0; i--) {
            j=Math.floor((i+1)*Math.random());
            e = a[i];
            a[i] = a[j];
            a[j] = e;
        }
}

You are welcome and if you are willing, please mark the thread as answered so we can filter the questions unanswered. Good luck!

Tags: Adobe Animate

Similar Questions

  • Repeat random issues (table) without

    How to make the random questions without repetition

    my code

    tanya var: Array = [suara_a, suara_b, suara_c, suara_d, suara_e];

    var jawab:Array = [[« A », « D », « C », « B »], [« B », « G », « J », « P »] [« C », « J », « O », « E »], [« D », « V », « T », « Q »] [« E », « W », « M », « P »]] ;

    var no = 0;

    var acak1;

    var acak2;

    Ganti();

    n.addEventListener (MouseEvent.CLICK, hnex);

    function hnex(Event:MouseEvent)

    {

    trace ("none" + no +);

    Ganti();

    }

    function ganti()

    {

    If (none == 5)

    {

    gotoAndStop (2);

    }

    on the other

    {

    acak1 = Math.ceil (Math.random () * 4);

    acak2 = Math.ceil (Math.random () * tanya.length)-1;

    b.Visible = false;

    s.Visible = false;

    So = new tanya [acak2] ();

    SC = so. Play();

    enable_disable (1);

    If (acak1 == 1)

    {

    PA. Text = jawab [acak2] [0]; pb.text = [acak2] jawab [1]; pc.text = [acak2] jawab [2]; pd.text = [acak2] jawab [3];

    }

    If (acak1 == 2)

    {

    PA. Text = jawab [acak2] [1]; pb.text = [acak2] jawab [0]; pc.text = [acak2] jawab [3]; pd.text = [acak2] jawab [2];

    }

    If (acak1 is 3)

    {

    PA. Text = jawab [acak2] [2]; pb.text = [acak2] jawab [3]; pc.text = [acak2] jawab [0]; pd.text = [acak2] jawab [1];

    }

    If (acak1 is 4)

    {

    PA. Text = jawab [acak2] [3]; pb.text = [acak2] jawab [2]; pc.text = [acak2] jawab [1]; pd.text = [acak2] jawab [0];

    }

    }

    }

    use:

    function shuffle(a:Array) {}

    var p:int;

    var t: *;

    var ivar:int;

    for (ivar =. Length-1; Ivar > = 0; Ivar-) {}

    p = Math.Floor ((Ivar+1) * Math.Random ());

    t = a [ivar];

    a [ivar] = a [p];

    a [p] = t;

    }

    }

    for example, if you want to shoot randomly tanya, use:

    Shuffle (Tanya);

    You can now browse the tanya randomzied.

  • 6 random numbers without repetition

    I'm doing a generator of 6 random numbers between 1 and 48. When the user clicks a button randomly 6 numbers appear in 6 different textFeilds. The problem is that I don't want the same number twice. How can I generate 6 different random numbers without using back and out of the service?

    import flash.events.Event;

    Stop();

    btn.addEventListener (MouseEvent.CLICK, random1);

    function random1 {(evt:Event)}

    display1. Text = "";

    Display2.text = "";

    Display3.text = "";

    display4. Text = "";

    display5. Text = "";

    display6. Text = "";

    var r1 = Math.floor (Math.random () *(1+48-1)) + 1;

    var r2 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A3 = Math.floor (Math.random () *(1+48-1)) + 1;

    var r4 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A5 = Math.floor (Math.random () *(1+48-1)) + 1;

    var A6 = Math.floor (Math.random () *(1+48-1)) + 1;

    If (r2 = r1 | r3 == r2 | r4 == r3 | r5 == r4 | r6 = r5) {}

    return;

    }

    var list: Array = new Array();

    Liste.push (R1, R2, R3, R4, R5, R6);

    Liste.sort (Array.Numeric);

    display1. Text = String (list [0]);

    Display2.Text = String (list [1]);

    Display3.Text = String (list [2]);

    display4. Text = String (list [3]);

    display5. Text = String (list [4]);

    display6. Text = String (list [5]);

    }

    Here is the code for the approach mentioned with your included textfields

    btn.addEventListener (MouseEvent.CLICK, random1);

    function random1 {(evt:Event)}

    var nums:Array = new Array();

    Complete the table of numbers

    for (var i: uint = 1; i<=48;>
    Nums.push (i);
    }

    Shuffle (NUMS);

    Take the first six of the mixed table

    var list: Array = nums.splice (0.6);

    assign values to the textfields

    for (var j: uint = 1; j<=6;>
    This ["Display" + String (j)] .text = String (list [j]);
    }
    }

    function shuffle(a:Array) {}
    var p:int;
    var t: *;
    var ivar:int;
    for (ivar =. Length-1; Ivar > = 0; Ivar-) {}
    p = Math.Floor ((Ivar+1) * Math.Random ());
    t = a [ivar];
    a [ivar] = a [p];
    a [p] = t;
    }
    }

  • Add values for them to table without accidental

    Hi I am writing a program for research at penn state behrend. It is designed to take a pressure transducer values and calculate pressure losses. My teacher wants to gather incriments of 10, their average values and then store all means when the user chooses you to start saving. I use a loop for to bring values and the average of the 10 output collected values in a table. After 10 averages are collected the program to output these values in a table. I can't understand how to continue to add to this table without overwriting the previous values. Any help would be appreciated. I'm uploading what I have so far. Thank you

    PS I use a generator of random numbers for testing only

    ajh305

    Keywords:

    Build the Array function

    shift registers

  • How to sort a random number without using the command by

    Hello

    How must be sorted, 5 random number without the use of order by in PLSQL
    for example.
    amount of ID
    1 2
    2 9
    3 3
    4 5
    5 7

    Edited by: sake1 1-dec-2010 08:16

    I used Altavista and found an example, how is it?

    DECLARE
    
      /* there is no built array in oracle, you must declare
      your own */
      TYPE Numarray IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
    
      /* the array of numbers - using assoc array because I can start
      with zero like traditional arrays */
      Nums Numarray;
    
      n NUMBER := 0;
    
      Temp NUMBER;
    
    BEGIN
    
      /* load up the array, put 20 random values in the array,
      in array indicies 0 to 19 */
      FOR i IN 0 .. 19
    
       LOOP
        Nums(i) :=  Round(Dbms_Random.Value(1, 1000));
      END LOOP;
    
      /* get the array size */
      n :=  Nums.Count();
    
      /* display the unsorted values - loop through the whole array and
      print out the values */
      Dbms_Output.Put_Line('unsorted:');
      FOR i IN Nums.First .. Nums.Last LOOP
        Dbms_Output.Put_Line(Nums(i));
      END LOOP;
    
      /* bubble sort - using two loops, compare each value with the one
      after it
      if the one after the current one is smaller , then
    
      switch their locations in the array, this is just like standard
      bubble sorts
      in other languages. The only real diff is the syntax.
      */
    
      FOR i IN 0 .. n - 1 LOOP
        FOR j IN 0 .. n - (i + 1) - 1 LOOP
    
          IF (Nums(j) > Nums(j + 1)) THEN
            Temp := Nums(j);
            Nums(j) :=  Nums(j + 1);
            Nums(j + 1) :=  Temp;
          END IF;
    
        END LOOP;
      END LOOP;
    
      /* display the values sorted */
      Dbms_Output.Put_Line('sorted');
      FOR i IN Nums.First .. Nums.Last LOOP
        Dbms_Output.Put_Line(Chr(9) || Nums(i));
      END LOOP;
    END;
    /*
    unsorted:
    155
    909
    795
    977
    942
    214
    105
    269
    283
    820
    108
    594
    784
    921
    856
    736
    802
    457
    951
    411
    sorted
         105
         108
         155
         214
         269
         283
         411
         457
         594
         736
         784
         795
         802
         820
         856
         909
         921
         942
         951
         977
    
    */
    

    In the code the first comment is wrong in fact, I think, this one:
    "There is no table built in oracle, you must declare your own."
    I remember there are some types of collection of the system, if I not mix with something, I remember there was a sort of like they were undocumented, so we can say legally that the comment in the code has always been right.

  • Potential problems for tables without primary keys and unique keys

    GoldenGate 11.2.1.0.3/Solaris 10
    DB: Oracle for Oracle (Source and target is 11.2.0.3)
    Topology: unidirectional


    In our one-way configuration GG, little of the tables being replicated is not a primary key or a Unique key.

    Last week when we have implemented GG for the test, we received warnings for these table below.
    GGSCI > add trandata WMHS_UD.crtn_dtl
    
    2013-01-12 11:34:33  WARNING OGG-00869  No unique key is defined for table 'CRTN_DTL'. All viable columns will be used to represent the key, but may not guarantee uniqueness.  KEYCOLS may be used to define the key.
    
    Logging of supplemental redo data enabled for table WMHS_UD.crtn_dtl.
    Replication seems to work very well for these tables.

    Googling, I think that there may be performance degradation when you replicate tables without PK or the United Kingdom.

    But are there other potential problems such as data of a certain kind not replicated to the lack of PK/UK?

    It really depends on the data.

    By default, GG is combining all columns as a virtual primary key but don't no conflict control by default. So when you can be sure that the record you insert into the table is unique, then it will work.
    BUT as soon as you insert the same record, which is already inserted, then you will encounter problems.

    Let me show what happens when you use an initial charge because it makes it easier to describe:
    We start at 10:00 the capture for a table. Now, you insert a record at 10:00 in the tables. When you now start an initial charge to 10.02, then check you have inserted in the database to 10.01 will be repeated two times. During the IPL as the initial charge is made to 10.02 and it includes data of 10.01 AND it will be replicated again through the process of capture/replicate.

  • You would design Tables without primary key?

    If you were asked to design a schema, if you create a table (however irrelevant) without a primary key? For example, a 'unprofessional' table such as a logging of errors table that records exceptions thrown from stored procedures, create you this table without a primary key?

    In a relational database you define und work with entities (tables) and you put in relationship to each other by joins. An entity must by definition always be identified by a unique key.
    If you don't know what kind of unique key identifies your entries in the table, it is almost certain that working from home in your datamodel and table designs had not been made. Your database objects contain tables, and they must have a unique identifier. Often it is a primary key (PK) composed of several columns.

    By definition a datamodel that contains the tables without primary keys is nomore a relational datamodel and one of the fundamental bases for the creation of a relational database is violated.

    Frankly I do not understand why Oracle allows the tables without primary key. Another system such as SAP R/3 are more stringent. Primary keys are required in the SAP and believe, when starting, it is sometimes tedious to define the primary key structures, but it's the basis of designing together relational datamodel you will put in place. You now SAP is based often on a DB ORACLE layer. They could do it, and these "extend" their functionality. But they are smart guys in Walldorf, and they always refrained to do. It's a good guess to believe, they have a good reason for it.

    Tables without primary key are NO relational tables, they are dungpiles. As Oracle needs priimary key itself in order to operate a relational database, ROWID have been defined. ROWID is the primary keys of the tables where the customer does not have a PK. But nice as ORACLE is, they strongly recommend not to use these ROWID in the application or database layer. ROWID is no identifier object that are stable in time and space (eg. two different databases in a distributed design oder a DEV and PROD-system).

    Definition of PK implies certain rules for the programming of your application and your DML operations. Especially you often MERGE in a relational table instead of simply INSERT'ing piece in a dungpile.

    When it later on with SELECT large datavolumes dataaccess, again the differences between well-defined joins (all based on the PK-relations) and joins non-unique keys will be the order of magnitude. Not only that, the latest degrades in performance much more quickly with the growth of result sets. When you start fumbling with no UNIQUE INDEXES, speed up performance in the operations of dungpiling you are already closer to hell than on a sunny day in the world of relational data.

    Othmar Lippuner
    SQL Reporting professional

  • Truncate a table without removing the redo log

    Hi Experts,

    Could you please tell me is it possible to truncate a table without removing the Redo log. In fact, I know it is not possible, but some body asked me the same question, and I want to be sure before answering him.

    Help, please.

    Concerning
    Rajat

    >
    I'm not familiar with these tearms (Flashback or Rman backup). But I acccess DBA. Could you please tell me the procedures.
    >
    You can restore data from a backup or export.

    You cannot use FLASHBACK to recover the data unless you use GR 11, 2 and that you have prepared (using TOTAL RECALL) for this in advance.

    See Tubby response in this thread
    Flashback the truncate table is possible in 11g?

  • maximum value for a column in a table without using rownum and rowid, group

    Hi all

    Is it possible to recover the maximum value in a column of a table without help:
    1 rownum and rowid.
    2. the Group
    3. any built-in function of Oracle.

    Kindly let me know if possible.


    Kind regards.

    Published by: J2EE_Life on January 23, 2012 21:06
    select e1.empno
      from scott.emp e1
      left outer join scott.emp e2 on e1.empno < e2.empno
     where e2.empno is null
    
  • &lt; af:table &gt; without a scroll bar?

    jDev Version: 11.1.1.13.0

    Is it possible to display a < af:table > without a scroll bar?
    My requirement is to display the rows of the table such that all lines should be displayed but no scroll bar. The height of the table should expand automatically when the number of lines increases. In my case the table shows a scroll bar.
    I'm keeping the element of array inside a < af:panelGroupLayout layout = "vertical" >

    Any help much appreciated...

    Definition of the attribute autoHeightRows on your table will make the Extensible table according to the number of rows you enter (the value can be derived through EL). Note that you must set contentDelivery immediate on the table, too.

    http://download.Oracle.com/docs/CD/E12839_01/apirefs.1111/e12419/tagdoc/af_table.html

  • Add a simple table without one logical join to another table (OBIEE 10 g)

    Sometimes I want to just show a simple table without a logical join to another table in the repository. However, every time I move the layer Business model and mapping and an audit of overall coherence, he tells me that he has a logical join and I am forced to create another table to join her. Creating a dimension-fact relationship. There are times where I need this relationship and I want to just display some data. Is anyway to circumvent this?

    Thanks in advance!

    Yes, you must create a join. You can't take one table to MDB layer. You can create an alias for the table. Join this alias and the base through any common column table and take the two tables in MDB and table you want to the presentation layer.

    Another way is to create a view in the physical layer. Write a select statement as

    Select Table primary_key

    Where primary_key is the primary key of the base table. Join the base table of view ith and repeat the steps defined for the Alias.

    Kind regards
    Sandeep

  • Insert values into a table from another table without duplicates

    Hello

    I have a table with a field called ID; This field has duplicate values of ID.

    Then I have an empty table B (with the same fields of the table A) and I want to insert the values of the ID (on the table) without duplicates.

    Can you help me?


    Thank you much in advance.

    Hello

    If your table has duplicate values, then you cannot add a UNIQUE constraint. In this case, you will need to use a roundabout way or remove duplicates before imposing the constraint. Hope it answers your question.

    see you soon

    VT

  • a table are in the other table without duplicate

    How to check the records in a table are in the other table without duplicate.

    for example, in the tables below, the records from the Table A are in Table B1. But the B2 table has duplicate and one record is missing.
    I want to know which records are not in table B, records that have two copies.
    as A and B2, 1 2 is not in B2, 1 1 a 2 folders in B2

    A and B1, nothing should be returned.

    Table A
    -----------
    A1 A2
    -----------
    1 1
    1 2
    1 3
    -----------

    Table B1
    -----------
    A1 A2
    -----------
    1 1
    1 4
    1 2
    1 3
    2 2
    -----------


    Table B2
    -----------
    A1 A2
    -----------
    1 1
    1 4
    1 3
    2 3
    1 1
    -----------

    version is the database of Oracle 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production

    Thank you!!

    Two standard methods to compare the tables are either to use DEFINED such as UNION, UNION operations or LESS.
    Or use a FULL OUTER JOIN.

    If the structure of the table is the same and that you want to compare all the columns, then set them operators are the best way.

    If you want to compare only on one or more columns and want to see the other columns, then a FULL OUTER JOIN is the best way.

    Here is an example

    select A1, A2,
          count(distinct sourcetable) cnt_tables,
          count(sourcetable) cnt_records,
          count(case when sourcetable = 'A'  then 1 end) record_is_in_A,
          count(case when sourcetable = 'B1'  then 1 end) record_is_in_B1,
          count(case when sourcetable = 'B2'  then 1 end) record_is_in_B2
       (select 'A' sourceTable, a.* from tableA a
        union all
        select 'B1' sourceTable, b1.* from tableB1 b1
        union all
        select 'B2' sourceTable, b2.* from tableB2 b2
       )
    group by A1, A2
    having  count(distinct sourcetable) < count(sourcetable) ;
    

    It is an example. It will show you the records that have duplicate data in the following tables.
    If you want to display all records that are in A but not in B1, you can add a few other checks.

    Published by: Sven w. on August 13, 2010 17:23

  • Insert data into the table without using the insert or select the command

    Hello

    Is there anyway to insert data from one table to another table, without using insert, and then select the command in the same pattern.
    Note: the two tables have the same structure.

    ALTER table... Swap partition...

  • What do you call a TABLE without constraints

    Is there any standard term to call a table that is to have no constraints.

    Called ordinary (heap-organized) or a Table without constraint.

    [http://download.oracle.com/docs/cd/B19306_01/server.102/b14231/tables.htm]
    [http://download.oracle.com/docs/cd/B12037_01/server.101/b10743/data_int.htm]

    -André

Maybe you are looking for

  • Firefox and safari... can not establish a connection with the server of http sites

    Hi I have a mcbook pro loaded with OSX X Yosemite 10.10.3. For some time on safari and firefox I can access https sites only and get an error message "Unable to connect", then then specifically line "Firefox can't establish a connection to the server

  • Looking for symbols of medical alert dials

    someone at - he saw a design from the front with the Med alert symbol?  I would like to combine my bracelet with watch.

  • Preparation of the upgrade of the operating system

    I'm about to spend DV4-1028us my wife from Vista to Windows 7. I would have preferred a upgrade to a clean install so I would'nt have to re - install all the app given the number of applications installed and uninstalled during the years, there is pr

  • Shado task does not connect to the Thin Client

    Trying to hide a T520 on HPDM 4.6SP4 thin client, when I run the task of shadow, I retrieve a VNC connection on the server HPDM and not the thin client. T520 thin clients are ThinPro 5. This happens on the T510 Smart thin clients zero Core as well. I

  • CreateProcess() returns 0

    CreateProcess() returns 0, the execution of this code: ZeroMemory (& TR, sizeof TR);Si.CB = sizeof is;result = CreateProcess (NULL, szCommand, NULL, NULL, FALSE, CREATE_DEFAULT_ERROR_MODE |) DETACHED_PROCESS,NULL, NULL, & TR, & piProcess);If (result