Last active
March 28, 2024 06:33
-
-
Save andrewcharlesmoss/092819ed423d5dbed7ff663f9a6ac4c1 to your computer and use it in GitHub Desktop.
RANDUNIQUE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// v2 | |
/* UPDATE 13/02/2022 | |
Added columns argument and made each optional | |
*/ | |
// Returns an array of unique random numbers | |
RANDUNIQUE = | |
LAMBDA([rows],[columns],[min],[max], | |
INDEX( | |
SORTBY( | |
SEQUENCE(max+1-min,,min), | |
RANDARRAY(max+1-min) | |
), | |
SEQUENCE(rows,columns) | |
) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// v1 | |
// Returns an array of unique random numbers | |
RANDUNIQUE = | |
LAMBDA(rows,min,max, | |
INDEX( | |
SORTBY( | |
SEQUENCE(max+1-min,,min), | |
RANDARRAY(max+1-min) | |
), | |
SEQUENCE(rows) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great