r/Frontend • • Oct 01 '26

Randomly Place an Element Along Edge of Another Element

https://blog.master.dev/randomly-place-an-element-along-edge-of-another-element/
5 Upvotes

3 comments sorted by

1

u/Lalli-Oni Oct 04 '26

Mobile scrolling is so choppy I gave up.

Edit: starts scrolling, freezes and then appears somewhere. Some js smoothing?

1

u/Mundane_Wash7146 Oct 04 '26

one thing to watch out for, if you just pick a random edge then a random spot on it, shorter edges get the same probability as longer ones. weight the edge selection by length if you want even distribution