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: 05 December 2008
Version: 1.1
*/
// ===================================
// RandomList ( ListToRandom ) v2.0__LITBR__// requires CustomList ( start ; End ; Function )__LITBR____LITBR__ /*__LITBR__ To mix a list (random)__LITBR__ */__LITBR____LITBR__//---------------------------------- Exemple__LITBR__// List_A contains "A¶B¶C¶D" -> Result : "B¶D¶A¶C" or "A¶D¶B¶C" or ....__LITBR____LITBR__//-------------------------------------------------------------------*/__LITBR__// Agnès Barouh - January 2008 - To report bugs : barouh.agnes@wanadoo.fr__LITBR__//-------------------------------------------------------------------*/__LITBR____LITBR__Let([__LITBR____LITBR__$Rc = ¶ ;__LITBR__$RL_MaListe = ListToRandom__LITBR____LITBR__];__LITBR__CustomList ( 1 ; ValueCount ( $RL_MaListe ) ;__LITBR__"Let ([__LITBR__Nbr = Int ( Random * ValueCount ( $RL_MaListe ) ) + 1 ;__LITBR__Pos = Position ( $rc & $RL_MaListe ; $Rc ; 1 ; Nbr ) ;__LITBR__Value = GetValue ( $RL_MaListe ; Nbr ) ;__LITBR__$RL_MaListe = Replace ( $RL_MaListe ; Pos ; Length ( Value ) + 1 ; \"\" )] ; Value )" )__LITBR__)__LITBR____LITBR__// ===================================__LITBR__/*__LITBR____LITBR__ This function is published on FileMaker Custom Functions__LITBR__ to check for updates and provide feedback and bug reports__LITBR__ please visit http://www.fmfunctions.com/fid/119__LITBR____LITBR__ Prototype: RandomList( ListToRandom )__LITBR__ Function Author: Agnès (http://www.fmfunctions.com/mid/46)__LITBR__ Last updated: 05 December 2008__LITBR__ Version: 1.1__LITBR____LITBR__*/__LITBR__// ===================================
Login or register to comment
Create a new account with fmcustomfunctions.com or login to post a comment.