RandomList ( )

Function stats

Average user rating
46
119
9999
Support
FileMaker 8.0 +
Date posted
06 December 2008
Last updated
06 December 2008
Version
Recursive function
No

Author Info
 Agnès

17 functions

Average Rating 4.6

author_avatar



 

Function overview

Prototype

RandomList  ( ListToRandom )


Parameters

ListToRandom  


Description

Tags:  Random   List  

To mix a list (random result) [make a list in the chaos]

- Keeps duplicates datas

-----------------------------------------
it is not a recursive function
Requires CustomList ( start ; End ; Function )
-----------------------------------------

Examples

Sample input

RandomList ( "Monday¶Tuesday¶Wednesday¶Thursday" )


Sample output

Random result :
Tuesday¶Wednesday¶Monday¶Thursday
or
Thursday¶Monday¶Tuesday¶Wednesday

 

Function code

// RandomList ( ListToRandom ) v2.0
// requires CustomList ( start ; End ; Function )

/*
To mix a list (random)
*/

//---------------------------------- Exemple
// List_A contains "A¶B¶C¶D" -> Result : "B¶D¶A¶C" or "A¶D¶B¶C" or ....

//-------------------------------------------------------------------*/
// Agnès Barouh - January 2008 - To report bugs : barouh.agnes@wanadoo.fr
//-------------------------------------------------------------------*/

Let([

$Rc = ¶ ;
$RL_MaListe = ListToRandom

];
CustomList ( 1 ; ValueCount ( $RL_MaListe ) ;
"Let ([
Nbr = Int ( Random * ValueCount ( $RL_MaListe ) ) + 1 ;
Pos = Position ( $rc & $RL_MaListe ; $Rc ; 1 ; Nbr ) ;
Value = GetValue ( $RL_MaListe ; Nbr ) ;
$RL_MaListe = Replace ( $RL_MaListe ; Pos ; Length ( Value ) + 1 ; \"\" )] ; Value )" )
)

// ===================================
/*

    This function is published on FileMaker Custom Functions
    to check for updates and provide feedback and bug reports
    please visit http://www.fmfunctions.com/fid/119

    Prototype: RandomList( ListToRandom )
    Function Author: Agnès (http://www.fmfunctions.com/mid/46)
    Last updated: 06 December 2008
    Version: 1.1

*/
// ===================================