frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Bolsonaro found guilty in attempted coup, assassination plot

https://www.washingtonpost.com/world/2025/09/11/bolsonaro-convicted-election-plot-assassinations/
2•celicoo•2m ago•0 comments

Grand Jury Indicts Three U.S. Citizens, 22 Chinese Nationals in Drug Trafficking

https://www.justice.gov/opa/pr/grand-jury-indicts-three-us-citizens-22-chinese-nationals-four-chi...
1•737min•3m ago•0 comments

Vortex: Next-generation columnar file format

https://vortex.dev
1•datadrivenangel•5m ago•0 comments

Declarative music – 2 Minute Deep Acid in Strudel (from scratch) [video]

https://www.youtube.com/watch?v=HkgV_-nJOuE
1•todsacerdoti•10m ago•0 comments

GPUs as Collateral – Chip Based Asset-Backed Securities

https://medium.com/@Elongated_musk/gpus-as-collateral-chip-based-abs-acf55ac3f135
1•walterbell•10m ago•0 comments

A Pollution Paradox: Western Wildfires Improve Air Quality on the East Coast

https://e360.yale.edu/digest/western-wildfires-east-coast-air-quality
1•YaleE360•12m ago•0 comments

How Palantir Is Mapping Everyone's Data for the Government

https://www.techdirt.com/2025/09/11/how-palantir-is-mapping-everyones-data-for-the-government/
14•mdhb•18m ago•0 comments

Using Claude's chat search and memory to build on previous context

https://support.anthropic.com/en/articles/11817273-using-claude-s-chat-search-and-memory-to-build...
1•runekaagaard•18m ago•0 comments

The math, mechanics, and risks of leveraged ETFs

https://www.signalbloom.ai/posts/ultimate-guide-leveraged-etfs/
1•GodelNumbering•19m ago•0 comments

Accelerated Game of Life with CUDA / Triton

https://www.boristhebrave.com/2025/09/11/accelerated-game-of-life-with-cuda-triton/
2•BorisTheBrave•22m ago•0 comments

Resistance or high-intensity interval training suppresses cancer cell growth

https://pubmed.ncbi.nlm.nih.gov/40608178/
3•bookofjoe•26m ago•0 comments

Matrix is email wearing a hoodie

https://gist.github.com/peterbourgon/04ef9dac27dfc55a0a0fd8e2467874ad
3•fanf2•26m ago•0 comments

Group finds and publishes previously unseen images of 9/11

https://www.cnn.com/2025/09/11/us/9-11-media-preservation-group-archive
3•Teever•27m ago•0 comments

Ask HN: Where to find current standards for AI-assisted development workflow?

1•chasebank•32m ago•0 comments

Unusual Capabilities of Nano Banana (Examples)

https://github.com/PicoTrex/Awesome-Nano-Banana-images/blob/main/README_en.md
13•SweetSoftPillow•33m ago•2 comments

Ancient DNA solves Plague of Justinian mystery to rewrite pandemic history

https://phys.org/news/2025-08-ancient-dna-plague-justinian-mystery.html
3•PaulHoule•35m ago•0 comments

K8o5.com/Mi

https://k8o5.com/mi
1•k8o5•36m ago•0 comments

Image-GS: Content-Adaptive Image Representation via 2D Gaussians

https://www.sdiolatz.info/publications/00ImageGS.html
2•LordNibbler•36m ago•0 comments

DeepSeek Rewrote the Transformer [video]

https://www.youtube.com/watch?v=0VLAoVGf_74
1•lawrenceyan•36m ago•0 comments

Ask HN: Which AI music services can generate strange sounds in music?

1•amichail•38m ago•0 comments

Philip Rosedale making manifesto for "playing entrepreneur on Hard Mode"

https://philiprosedale.substack.com/p/strong-capitalism
1•SLHamlet•41m ago•1 comments

First megawatt-level 'windmill' airship set to generate power in China

https://interestingengineering.com/energy/china-unveils-megawatt-level-windmill-airship
3•simonebrunozzi•41m ago•0 comments

Writing effective tools for LLM agents–using LLM agents

https://www.anthropic.com/engineering/writing-tools-for-agents
3•davidbarker•44m ago•0 comments

Autism Has No Single Cause. Here’s How We Know

https://www.scientificamerican.com/article/autism-has-no-single-cause-research-shows/
9•hbcondo714•45m ago•0 comments

CFTC pick says entrepreneur Winklevoss lobbied president to delay nomination

https://www.reuters.com/sustainability/boards-policy-regulation/trumps-cftc-pick-says-entrepreneu...
2•impish9208•46m ago•0 comments

Httpjail: Monitor and restrict HTTP/HTTPS requests from processes

https://github.com/coder/httpjail
2•Bogdanp•48m ago•0 comments

'Lavender': The AI machine directing Israel's bombing spree in Gaza

https://www.972mag.com/lavender-ai-israeli-army-gaza/
11•ciconia•48m ago•0 comments

The newly discovered desert city that's rewriting the history of the Americas

https://www.bbc.com/travel/article/20250910-perus-new-city-unearthed-from-the-desert
3•bookofjoe•50m ago•0 comments

Show HN: Chess Invite, start a game of chess, share the link

https://chessinvite.com/
1•jrnkntl•51m ago•0 comments

Bringing Memory to Teams at Work

https://www.anthropic.com/news/memory
2•extr•55m ago•0 comments
Open in hackernews

Randomly selecting points inside a triangle

https://www.johndcook.com/blog/2025/09/11/random-inside-triangle/
45•ibobev•1h ago

Comments

ok123456•1h ago
If it's the whole triangle, use a Dirichlet RNG with alpha=1.
simlevesque•32m ago
What's a "whole triangle" ? Google leads me nowhere.
cluckindan•1h ago
Generate random points inside a square (trivial), mirror one half by the diagonal (preserves distribution), transform coordinates inside the resulting triangle to the given triangle.
mytailorisrich•1h ago
That's essentially the accept-flip method of the article, isn't it?
emil-lp•59m ago
You mean inside the resulting rectangle?

That's what the article suggests.

aaronblohowiak•53m ago
no, this person is not suggesting a parallelogram but rather performing an affine transformation on the triangle to make it a right triangle so they can pick a random point in a square instead. as another commenter mentioned, I believe this distorts the distribution and won't do the right thing.
o11c•29m ago
There's no distortion for the purposes of randomness (there would be if you cared about distance between specific points before/after the transformation), but the blog article fails to actually explain the method.

Clicking through to SO explains it (but assumes you can read numpy). The `s * u` and `t * v` (where `u` and `v` are vectors) are the transformation from right-triangle (half of square) to triangle (half of parallelgram).

creata•21m ago
https://en.wikipedia.org/wiki/Probability_density_function#V...

Affine transformations just scale the probability density by a constant, so a uniform distribution is still uniform.

saltcured•57m ago
Wouldn't that subsequent transform distort the sample distribution? As you make the angle at one vertex more obtuse, the density of the point mapping increases more there relative to the points near the other, more acute vertices.
hatthew•45m ago
I believe an affine transformation would keep density perfectly consistent across the whole area.
atq2119•40m ago
Affine transformations don't change relative density.

You can think of it this way. There's a density function on the shapes in question. Whenever you transform the 2d space, you have to adjust the density at the same time to preserve "volume" (area times density).

Non-linear transforms, such as interpreting a square as polar coordinates to obtain a disk, will expand or shrink area differently in different parts of the space, which means that if you start with a uniform density, you end up with a non-uniform density. But linear/affine transforms affect area the same everywhere in the space, and so if the density is uniform to begin with, it remains uniform.

hatthew•53m ago
I doubt I'm more geometrically inclined than the average HN user, but to me the general "accept-flip" method mentioned here seems trivial, obvious, and already solved, to the extent that I'm surprised it's worth writing more about or considering any alternatives.
spankalee•49m ago
Generating random points uniformly in a circle without rejection is at least mildly more interesting, as you need to scale one factor by a square root:

    const r = sqrt(random()) * radius;
    const theta = random() * TAU;
hatthew•42m ago
Yeah that would be at least nontrivial, but has been written about so much that the bar for a worthwhile article seems pretty high.
arijun•37m ago
Wait, wouldn't this result in the opposite of what you want? You want to shift the distribution out, not crowd the center, so you probably want to square your random instead.
hatthew•32m ago
assuming random() returns values 0<=r<=1, sqrt will shift the distribution outward
Jtsummers•30m ago
Squaring numbers in (0,1) makes them smaller, pulling the random radius closer to center. As an example consider 0.9. Squaring it gets 0.81 vs 0.949 taking the square root.
hhmc•23m ago
Because the numbers are less than 1 sqrt pulls them towards 1 (the edge)
hk__2•29m ago
Obligatory xkcd: https://xkcd.com/1053/
o11c•33m ago
This appears to be low-quality blogspam. It fails to even explain the main method (delegating to a handwaved "generate in a parallelogram").
hatthew•29m ago
I didn't want to be that critical right out of the gate, but yeah if an "experienced consultant" thinks that this is worth writing about at this level of detail, then that makes me trust them less, not more.
oakwhiz•4m ago
A parallelogram is just a rectangle with extra steps. Maybe they could have mentioned what those steps are but it seems fairly straightforward
mweatherley•32m ago
A tidbit here some might be interested in is that a version of the accept-flip method works for simplices of arbitrary dimension.

For an n-simplex, start by generating a random point in an n-cube (i.e. n uniform random numbers between 0 and 1).

Next, sort the coordinates. This leaves you with a chain `0 <= c_1 <= ... <= c_n <= 1`.

Taking successive differences from this chain gives you n+1 numbers `d_j` (`0 <= j <= n`) that sum to 1.

Finally, the random point in the n-simplex is just `j_0 v_0 + ... + j_n v_n`, where `v_j` are the vertices of the simplex.

It's not hard to verify that this produces the accept-flip technique in dimension 2. As for why it's uniform: the sorting step is mapping a coordinate in the cube into a fundamental domain for the action of the symmetric group (which breaks the cube into a number of simplices of equal size); the other steps are linear maps, which therefore preserve the uniformity.

Syzygies•13m ago
I coauthored the paper "Trailing the Dovetail Shuffle to its Lair" which solved the GSR model for riffle shuffling in closed form, leading to the recommendation to shuffle a 52 card deck seven times.

Your picture is a great geometric way to think about riffle shuffling. Your n-simplex represents a sorted deck of n cards. Choosing a point uniformly at random in this simplex makes the needed choices all at once to predetermine an arbitrary number of riffle shuffles. Think of k riffle shuffles as a single 2^k shuffle (as if you had 2^k hands); we can now study an "a-shuffle". Scale the n-simplex by a factor of a. Where does our random point end up? Either view all of space as tiled by your n-cubes, or reduce all coordinates mod 1. Either way the random point ends up in some n-simplex described by a different (or the same) order (mod 1) of the coordinates. That's your shuffle.

For a single shuffle of two cards, doubling the 2-simplex ("up-triangle") covers three up-triangles and one down-triangle, so the odds of reversing the cards is 1 in 4. This makes sense if you imagine two "stowaway" cards face up, placed at random in a face-down deck. Shuffling the deck, to reverse these cards they can't both be in the same packet, and being in different packets only reverses them half the time.

Increasing "a" for two cards, one sees the up and down-triangle counts converge to a 1:1 ratio. The error "fringe" looks like a numerical integration error.

Malipeddi•26m ago
There are other quite elegent methods for triangle and simplices.

For a triangle, drawing α and β uniform over [0,1) the barycentric coordinates given by (1-sqrt(α), sqrt(alpha)(1-β), βsqrt(alpha)) is uniform over the triangle. No rejection and no test for flipping.

For simplices (triangle, tetrahedron, 5-cell etc) barycentric coordinates obtained by drawing uniformly from (0,1] taking a log and normalizing will be uniform within the simplex.

I wrote about this and other related sampling below.

https://abhila.sh/writing/5/Random_Sampling.html

https://abhila.sh/writing/8/Random_Sampling_2.html

tempfile•14m ago
Here was a cute idea I thought of. Divide the triangle into 4 by joining the midpoints (a "triforce" shape). The four triangles are congruent, each equal to a quarter of the larger triangle. Generate a uniform 1/4 probability event in your favourite way (flip two coins) and accordingly choose one of the triangles to contain your point. Repeat this indefinitely to get an exponentially small triangle containing your point.

I think this should be a uniform distribution by symmetry. Obviously the boundaries of the triangles never get picked but that's a measure 0 set.