List randomizer

Version 2

     

    Custom Function

     

    Compatibility
    Creator
    Mac OS X, Windows
    Johan Småros
    FMP 7, 8, 8.5, 9, 10, 11
    PositionEtt AB
    Web: Yes
    File Type: FP7
    Server: Yes
    FileSize: ~ .05 megabytes
    http://www.positionett.se

    Description

    This function randomizes the order of a return delimited list.

     


    Code

    // Function: ListRandomizer (theList)

    // Parameter: theList, a return delimited list

    // Result: Returns the values of theList in random order

    //

    // Johan Småros, PositionEtt AB, 2009-06-24

    // johan@positionett.se

     

    Let([

    theLength = ValueCount ( theList ) ;

    theChosen = Ceiling ( theLength * Random )

    ] ;

     

    If( theLength ≤ 1 ; theList ;

    MiddleValues ( theList ; theChosen ; 1 ) & ListRandomizer(LeftValues(theList ; theChosen -1) & RightValues(theList ; theLength-theChosen)))

    )

     

    Sample Input

    Sample Output

    one

    two

    three

    four


    four

    two

    three

    one

     


    Developer's Notes

     

     


    FileMaker Inc. provides this content on an “As Is” basis, without any warranty, and subject to the terms of the FileMaker Technical Network Agreement. FileMaker makes no representations and is not liable for any content or related information. You may use the content as part of your own solutions and for your customers, but you may not otherwise publicly distribute any content that you did not submit. ©2009-2011 FileMaker, Inc. All Rights Reserved. FileMaker is a trademark of FileMaker, Inc. registered in the U.S. and other countries.