You can roll two or three dice to get a non-uniform distribution.
That is, (math.random() + math.random()) / 2
will give you a pyramidal distribution with values closer to 0.5 appearing a lot more often than near 1 or 0. If you average 3 dice instead, you get a bell curve.
However, the distribution is always symmetrical.
You can also square a random number 0-1 to get a lower random number.
math.random() ^ 2
will get you a distribution where 0-adjacent values are a lot more common than high values. The distribution should look like a straight line going down iirc.
After some tinkering, I combined the two. I’m not sure what the curve should look like, though.
((math.random() ^ 1.5) + (math.random() ^ 1.5)) / 2
Example with 10000 samples:
{ [0] = 26, 55, 74, 76, 78, 86, 78, 83, 98, 112, 115, 111, 91, 101, 118, 118,
122, 134, 137, 101, 129, 144, 144, 144, 172, 163, 136, 149, 157, 149, 174,
154, 160, 175, 163, 153, 185, 158, 152, 183, 179, 172, 188, 187, 191, 181,
170, 193, 171, 185, 170, 157, 145, 135, 147, 130, 121, 123, 98, 124, 110, 90,
97, 93, 89, 78, 83, 69, 58, 61, 66, 69, 63, 59, 48, 45, 50, 44, 46, 54, 42,
32, 35, 39, 31, 32, 28, 21, 24, 19, 23, 15, 18, 15, 8, 7, 6, 7, 1, 0 }
Definitely use @tlr22’s solution, it lets you design the probability curve.
edit: christ, it still has a peak at 0.5
===============
=======================
============================
===============================
==================================
=====================================
=======================================
========================================
===========================================
============================================
=============================================
===============================================
================================================
=================================================
===================================================
====================================================
=====================================================
======================================================
=======================================================
========================================================
=========================================================
==========================================================
===========================================================
============================================================
============================================================
=============================================================
==============================================================
===============================================================
=================================================================
=================================================================
==================================================================
===================================================================
==================================================================
===================================================================
====================================================================
=====================================================================
=====================================================================
======================================================================
=======================================================================
========================================================================
========================================================================
========================================================================
=========================================================================
==========================================================================
==========================================================================
===========================================================================
============================================================================
=============================================================================
============================================================================
==============================================================================
=========================================================================
====================================================================
================================================================
============================================================
=========================================================
=======================================================
===================================================
=================================================
===============================================
==============================================
============================================
=========================================
========================================
======================================
=====================================
===================================
==================================
================================
===============================
==============================
============================
===========================
=========================
========================
=======================
======================
=====================
====================
===================
==================
=================
===============
===============
==============
============
============
===========
==========
=========
========
=======
======
=====
=====
====
===
==
=
=