CSV RandomPicker:
The CSVRandomPicker node is designed to randomly select a specified number of elements from a given CSV (Comma-Separated Values) string. This node is particularly useful when you need to extract random samples from a list of items, such as words or phrases, provided in a CSV format. By utilizing a seed value, the node ensures that the selection process can be replicated, which is beneficial for scenarios where consistent results are required across different runs. The node's primary function is to facilitate the random selection of items, making it a valuable tool for tasks that involve random sampling or shuffling of data in a controlled manner.
CSV RandomPicker Input Parameters:
csv_string
The csv_string parameter is a multiline string input that contains the list of items you want to randomly select from, separated by a specified delimiter. This parameter allows you to input a series of words or phrases in CSV format, such as "apple,banana,cat,dog". The default value is "apple,banana,cat,dog", and it supports multiline input to accommodate longer lists.
count
The count parameter specifies the number of items to randomly select from the csv_string. It determines how many elements will be picked in each execution of the node. The default value is 1, with a minimum of 1 and a maximum of 1000. This parameter directly impacts the number of items returned by the node.
separator
The separator parameter defines the character used to separate items in the csv_string. By default, it is set to a comma (,), which is typical for CSV formats. This parameter allows you to customize the delimiter if your input string uses a different separator.
seed
The seed parameter is an integer that initializes the random number generator used for selecting items. It ensures that the selection process is repeatable, meaning the same seed will produce the same selection of items each time the node is executed. The default value is 0, with a range from 0 to 1125899906842624.
CSV RandomPicker Output Parameters:
STRING
The output of the CSVRandomPicker node is a single string that contains the randomly selected items from the csv_string, joined by the specified separator. This output provides the selected elements in a format that can be easily used in subsequent processes or nodes.
CSV RandomPicker Usage Tips:
- To ensure consistent results across different runs, use the same
seedvalue. This is particularly useful for debugging or when you need to reproduce specific outcomes. - If you have a large list of items and only need a few random selections, adjust the
countparameter accordingly to avoid unnecessary processing and to focus on the desired number of outputs.
CSV RandomPicker Common Errors and Solutions:
"max_count" must be greater than "min_count"!
- Explanation: This error occurs when the
countparameter is set to a value greater than the number of available items in thecsv_string. - Solution: Ensure that the
countparameter does not exceed the number of items in yourcsv_string. Adjust thecountto be less than or equal to the number of items available.
Empty output
- Explanation: This issue arises when the
csv_stringis empty or only contains separators without any actual items. - Solution: Check that your
csv_stringcontains valid items separated by the specifiedseparator. Ensure there are no unintended spaces or empty entries.
