Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

random(list) should work #1035

Open
LeaVerou opened this issue Aug 13, 2024 · 1 comment
Open

random(list) should work #1035

LeaVerou opened this issue Aug 13, 2024 · 1 comment
Labels
Effort: low Easy to address issues, ideal for first time contributors! Priority: low Status: 4. Ready to implement We know how to implement this, but who will do it? Topic: Formulas

Comments

@LeaVerou
Copy link
Member

Currently to pick a random item from a list you need to either do first(shuffle(list)) (which is also wasteful) or get(list, random(0, count(list))) which is also very roundabout. random(list) should just work.

@LeaVerou LeaVerou added Effort: low Easy to address issues, ideal for first time contributors! Priority: low Status: 4. Ready to implement We know how to implement this, but who will do it? Topic: Formulas labels Aug 13, 2024
@karger
Copy link
Collaborator

karger commented Jan 7, 2025

would it make sense to have a second argument specifying the number of items you want returned? It would require returning an item if there is no argument and a list (even if it is a list of one item) if there is a second argument. Would this inconsistency be a bad choice?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Effort: low Easy to address issues, ideal for first time contributors! Priority: low Status: 4. Ready to implement We know how to implement this, but who will do it? Topic: Formulas
Projects
None yet
Development

No branches or pull requests

2 participants