What are you trying to do? Generate random records or find random records from an existing set (and 5 at a time... I guess?)
Might this work for you? (for after your original find):
Go to Layout ["RecipeName" (RecipeName)]
Show All Records
Enter Find Mode [Pause]
Set Field 
Insert Text [Select; RecipeName::Remark; ""Cooked""]
Set field [RecipeName::Remark; ""Cooked""]
Perform Find 
Replace Field Contents [No dialog; RecipeName::Random; Random]
Sort Records by Field [Ascending; RecipeName::Random]
Go to Record/Request/Page [First]
Omit Multiple Records [No dialog; 5]
Show Omitted Only
Insert steps from screenshot here
I'm sure there's someone out there with a more elegant solution, but it seems like this would work for you?
What I need to do is to find one type of food and to omit "Cooked" records as well. After the found list comes out, pick 5 random records from the list. I may need to run the script again so that I can get another random set from the remaining uncooked records.
Your script needs a Perform Find script step before the first loop.
Good catch. I think I got a little trigger-happy with the strikeout.
That's clear :-).
I would probably create a relationship to the records from a global field e.g.
a_table::_id_RecipeName -> RecipeName::id a_table could be the RecipeName table if wanted.
To use the records fill the global with the 5 random records. Which could be shown in a portal.
If the amount of recipes is under 10.000 (due to limit of recursion in shuffle list custom function) one option is to use SQL to get the RecipeName ids save that list then put 5 random values in the _id_RecipeName global. and use that list to remove those values from the $$recipeFoundList.
in code that would be something like
# Do Once.
$$recipeList = ExecuteSQL ("SELECT id FROM RecipeName WHERE Remark <> 'Cooked' AND TypeOfFood = ? ; "" ; "" ; $typeOfFood )
# Call this everytime you need 5 more
$shuffledList = ShuffleValues ($$recipeList ) (ShuffleValues is a custom function e.g. FileMaker Custom Function:ShuffleValues ( List ) )
$recipeRandomList = GetLeftValues ( $shuffledList ; 5 ) // the five random
$$recipeFoundList = GetRightValues ($shuffledList ; ValueCount ( $shuffledList ) - 5 ) // save the rest of the list.
SetField ( a_table::_id_RecipeName ) = $recipeRandomList // select the 5 random recipes for in a portal e.g.
$$recipeList = $shuffledList // save the remaining values for next round.
Then clear the globals when you need to reset the whole thing.
Thank you rrrichie!