Last active
May 20, 2025 09:08
-
-
Save rabestro/a4625b37f38bde022ecdd720c92dd141 to your computer and use it in GitHub Desktop.
List of random numbers
This file contains hidden or 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
let | |
Source = fxRandomNumbers(12) | |
in | |
Source |
This file contains hidden or 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
(limit as number) => | |
let | |
RandomNumber = () => Number.RoundDown(Number.RandomBetween(0, 1e9)), | |
Source = List.Generate(RandomNumber, each true, each RandomNumber()), | |
Numbers = List.FirstN(Source, limit) | |
in | |
Numbers |
This file contains hidden or 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
let | |
Numbers = [ | |
0 = "zero", | |
1 = "one", | |
2 = "two", | |
3 = "three", | |
4 = "four", | |
5 = "five", | |
6 = "six", | |
7 = "seven", | |
8 = "eight", | |
9 = "nine", | |
10 = "ten", | |
11 = "eleven", | |
12 = "twelve", | |
13 = "thirteen", | |
14 = "fourteen", | |
15 = "fifteen", | |
16 = "sixteen", | |
17 = "seventeen", | |
18 = "eighteen", | |
19 = "nineteen", | |
20 = "twenty", | |
30 = "thirty", | |
40 = "forty", | |
50 = "fifty", | |
60 = "sixty", | |
70 = "seventy", | |
80 = "eighty", | |
90 = "ninety" | |
], | |
Hundred = 100, | |
Thousand = 1000, | |
Million = 1000000, | |
Billion = 1000000000, | |
SayNumber = (n as number) as text => | |
let | |
Key = Text.From(n), | |
SayMagnitude = (divisor as number, name as text) as text => | |
let | |
QuotientPart = @SayNumber(Number.RoundDown(n / divisor)) & " " & name, | |
Remainder = Number.Mod(n, divisor) | |
in | |
if Remainder = 0 then | |
QuotientPart | |
else | |
QuotientPart & " " & @SayNumber(Remainder) | |
in | |
if Record.HasFields(Numbers, Key) then | |
Record.Field(Numbers, Key) | |
else if n < 0 then | |
"negative " & @SayNumber(-n) | |
else if n < Hundred then | |
@SayNumber(Number.RoundDown(n / 10) * 10) & "-" & @SayNumber(Number.Mod(n, 10)) | |
else if n < Thousand then | |
@SayMagnitude(Hundred, "hundred") | |
else if n < Million then | |
@SayMagnitude(Thousand, "hundred") | |
else if n < Billion then | |
@SayMagnitude(Million, "million") | |
else | |
@SayMagnitude(Billion, "billion") | |
in | |
SayNumber |
This file contains hidden or 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
let | |
Source = Table.FromList(DozenRandomNumbers, Splitter.SplitByNothing(), {"Number"}), | |
WholeNumbers = Table.TransformColumnTypes(Source, {{"Number", Int64.Type}}), | |
PronounceableNumbers = Table.AddColumn(WholeNumbers, "SayNumber", each fxSayNumber([Number])) | |
in | |
PronounceableNumbers |
Author
rabestro
commented
May 19, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment