Sean D. Stuber's Avatar

Sean D. Stuber

@sdstuber.bsky.social

Oracle Developer/DBA SQL, PL/SQL, and APEX Oracle ACE I blog at https://seanstuber.com

125 Followers  |  118 Following  |  19 Posts  |  Joined: 18.11.2024  |  1.3274

Latest posts by sdstuber.bsky.social on Bluesky

Using SQL to derive dice distributions in D&D In a previous article (Bringing APEX and PL/SQL to D&D) I used a package with formulas of predetermined distributions for rolling multiple dice. In this article I will show how I came up with those formulas. In each case of rolling multiple 20-sided dice, I didn't know before hand what the results would be; but I assumed there would be patterns I could write as expressions.

Using SQL to derive dice distributions in D&D

In a previous article (Bringing APEX and PL/SQL to D&D) I used a package with formulas of predetermined distributions for rolling multiple dice. In this article I will show how I came up with those formulas. In each case of rolling multiple 20-sided…

29.07.2025 06:06 — 👍 1    🔁 0    💬 0    📌 0
Bringing APEX and PL/SQL to D&D While there are plenty of opportunities in the real world to use APEX; I felt the need to bring APEX into my gaming. The idea started with a conversation in mid-game about some tactical decisions in a game of Dungeons & Dragons. That is, how should we go about tackling an upcoming combat. After awhile it turned into some meta-gaming of the mathematical implications of various options.

Bringing APEX and PL/SQL to D&D

While there are plenty of opportunities in the real world to use APEX; I felt the need to bring APEX into my gaming. The idea started with a conversation in mid-game about some tactical decisions in a game of Dungeons & Dragons. That is, how should we go about…

20.07.2025 00:09 — 👍 1    🔁 0    💬 0    📌 0
Post image

One more year.
Thank you @oracleace

27.06.2025 04:19 — 👍 2    🔁 0    💬 0    📌 0
Interesting bug with nondeterministic functions I was working on a little simulation using random numbers and found I was getting odd results from my query. After spending a while dissecting it trying to find my error I found the problem was in the database itself. I was able to replicate the problem on Live SQL using a simple test case with both 19c and 23ai…

Interesting bug with nondeterministic functions

I was working on a little simulation using random numbers and found I was getting odd results from my query. After spending a while dissecting it trying to find my error I found the problem was in the database itself. I was able to replicate the…

14.05.2025 04:48 — 👍 0    🔁 0    💬 0    📌 0
New Certification and FeedSpot Recognition I successfully completed my Oracle AI Vector Search certification. I was also elated to hear FeedSpot has, again, selected my blog as one of the Top 100 Oracle Blogs on the web.

New Certification and FeedSpot Recognition

I successfully completed my Oracle AI Vector Search certification. I was also elated to hear FeedSpot has, again, selected my blog as one of the Top 100 Oracle Blogs on the web.

14.04.2025 03:45 — 👍 3    🔁 0    💬 0    📌 0
PL/SQL package for 32-bit xoshiro/xoroshiro pseudorandom number generators Wrapping up my series on the, xoshiro/xoroshiro algorithms, in this article I present a package to return 32-bit values using the following variants. xoroshiro64* xoroshiro64** xoshiro128+ xoshiro128++ xoshiro128** The numbers in the names refer to the size of the state array that each method operates on. The 64s operate on two 32-bit values, while the 128s operate on four 32-bit values.

PL/SQL package for 32-bit xoshiro/xoroshiro pseudorandom number generators

Wrapping up my series on the, xoshiro/xoroshiro algorithms, in this article I present a package to return 32-bit values using the following variants. xoroshiro64* xoroshiro64** xoshiro128+ xoshiro128++ xoshiro128** The…

15.03.2025 23:36 — 👍 2    🔁 0    💬 0    📌 0
PL/SQL package for 64-bit xoshiro/xoroshiro pseudo-random number generators Continuing in the path of previous two posts, the package below supports all of the xoshiro/xoroshiro algorithms returning 64-bit values. xoroshiro128+ xoroshiro128++ xoroshiro128** xoshiro256+ xoshiro256++ xoshiro256** xoshiro512+ xoshiro512++ xoshiro512** xoroshiro1024* xoroshiro1024++ xoroshiro1024** The numbers in the names refer to the size of the state array that each method operates on. Using each of them follows the same pattern: Choose the algorithm mode (the package defaults to xoshiro256++)

PL/SQL package for 64-bit xoshiro/xoroshiro pseudo-random number generators

Continuing in the path of previous two posts, the package below supports all of the xoshiro/xoroshiro algorithms returning 64-bit values. xoroshiro128+ xoroshiro128++ xoroshiro128** xoshiro256+ xoshiro256++ xoshiro256**…

02.03.2025 00:50 — 👍 0    🔁 0    💬 0    📌 0
Bit manipulation of large numbers in pl/sql As I mentioned in my previous post I had to write my own functions to perform some bit operations on numeric values. While looking into some other pseudo-random number generators I ran into a few unexpected problems. The first problem is actually a documented restriction; but one I had not encountered previously. The BITAND function only supports numbers up to 2127-1.

Bit manipulation of large numbers in pl/sql

As I mentioned in my previous post I had to write my own functions to perform some bit operations on numeric values. While looking into some other pseudo-random number generators I ran into a few unexpected problems. The first problem is actually a…

17.02.2025 00:46 — 👍 0    🔁 0    💬 0    📌 0
Implementing xoshiro256** in PL/SQL A long time ago I ported the Mersenne Twister pseudo-random number generator to pl/sql. That algorithm, and my port, are showing their age so I started looking at other generators. A newer approach is found in the xoshiro/xoroshiro family by David Blackman and Sebastiano Vigna found here. I've chosen xoshiro256** as one of their "all-purpose, rock-solidgenerators". Like the Mersenne Twister, the original source is written in c and utilizes numerous bit manipulations to generate new values from the prior ones.

Implementing xoshiro256** in PL/SQL

A long time ago I ported the Mersenne Twister pseudo-random number generator to pl/sql. That algorithm, and my port, are showing their age so I started looking at other generators. A newer approach is found in the xoshiro/xoroshiro family by David Blackman and…

14.02.2025 22:31 — 👍 1    🔁 0    💬 0    📌 0
Advent of Code 2024 – Day 4 Ceres Search Day 4 took a different turn, we're still parsing through text to find special values, but now we need to parse horizontally, vertically, and diagonally through a grid of text looking for "XMAS", which could appear forwards or backwards (SAMX.) For this I built a two-dimensional map of the text. As I read each line, looking for horizontal instances of XMAS was trivial, I just used REGEXP_COUNT to look for XMAS and SMAX.

Advent of Code 2024 – Day 4

Ceres Search Day 4 took a different turn, we're still parsing through text to find special values, but now we need to parse horizontally, vertically, and diagonally through a grid of text looking for "XMAS", which could appear forwards or backwards (SAMX.) For this I…

25.01.2025 23:00 — 👍 0    🔁 0    💬 0    📌 0
Advent of Code 2024 – Day 3 Mull It Over For Day 3, we're given sequences of fictitious code and we have to extract the multiplication commands from it; which will be of the form "mul(x,y)" where x and y are integers. So, using a regular expression makes finding the valid substrings easy. Once those are extracted, it's just a matter of extracting the two numeric parameters from within the parentheses, multiplying them, and then summing the products.

Advent of Code 2024 – Day 3

Mull It Over For Day 3, we're given sequences of fictitious code and we have to extract the multiplication commands from it; which will be of the form "mul(x,y)" where x and y are integers. So, using a regular expression makes finding the valid substrings easy. Once…

25.01.2025 22:22 — 👍 0    🔁 0    💬 0    📌 0
Advent of Code 2024 – Day 2 Red-Nosed Reports For Day 2, we have to find sequences of numbers that are safe to process. For part 1, "safe" means the numbers are in order, either increasing or decreasing, and the step between each is never more than 3. My approach to this was to pivot each row of numbers into a sequence, which would then let me use the LAG function to compare the numbers in order.

Advent of Code 2024 – Day 2

Red-Nosed Reports For Day 2, we have to find sequences of numbers that are safe to process. For part 1, "safe" means the numbers are in order, either increasing or decreasing, and the step between each is never more than 3. My approach to this was to pivot each row of…

25.01.2025 21:57 — 👍 0    🔁 0    💬 0    📌 0
Advent of Code 2024 – Day 1 Historian Hysteria In this puzzle we're given 2 lists of numbers that should be paired together such that the smallest value of each list form a pair, then the next smallest, and so on until we pair the largest values from each list together. To solve it, I read the values from each line of the input file, parsing the two numbers into A and B columns corresponding to the values of the left and right lists respectively.

Advent of Code 2024 – Day 1

Historian Hysteria In this puzzle we're given 2 lists of numbers that should be paired together such that the smallest value of each list form a pair, then the next smallest, and so on until we pair the largest values from each list together. To solve it, I read the…

17.01.2025 02:17 — 👍 1    🔁 0    💬 0    📌 0
Day 19 - Advent of Code 2024

I've completed "Linen Layout" - Day 19 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/19

I started off with the wrong approach but ended up going back to day 11 for similar solution. pl/sql block found 601 trillion combinations in under 2 seconds.

19.12.2024 16:33 — 👍 5    🔁 0    💬 0    📌 0
Day 10 - Advent of Code 2024

I just completed "Hoof It" - Day 10 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/10

10.12.2024 05:24 — 👍 3    🔁 0    💬 0    📌 0
Day 8 - Advent of Code 2024

I just completed "Resonant Collinearity" - Day 8 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/8

08.12.2024 14:38 — 👍 3    🔁 0    💬 0    📌 0
Day 6 - Advent of Code 2024

I completed "Guard Gallivant" - Day 6 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/6

This one I had a small error in my part 1 that still produced the correct answer! But in part 2 I wasted hours looking for the error in the new code that was correct the whole time.

07.12.2024 03:54 — 👍 3    🔁 0    💬 0    📌 0

I just completed "Ceres Search" - Day 4 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/4

04.12.2024 06:03 — 👍 3    🔁 0    💬 0    📌 0

I just completed "Mull It Over" - Day 3 - Advent of Code 2024 #AdventOfCode adventofcode.com/2024/day/3

03.12.2024 06:12 — 👍 4    🔁 0    💬 0    📌 0

@sdstuber is following 20 prominent accounts