Math.rst 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Math - Math utility functions
  2. -----------------------------
  3. .. rubric:: Methods
  4. .. function:: Math.clamp(x, a, b)
  5. Clamps the x to be between a and b
  6. :param float x: value to be clamped
  7. :param float a: minimum value
  8. :param float b: maximum value
  9. :returns: Clamped value
  10. :rtype: float
  11. .. function:: Math.clampBottom(x, a)
  12. Clamps the x to be larger than a
  13. :param float x: value to be clamped
  14. :param float a: minimum value
  15. :returns: Clamped value
  16. :rtype: float
  17. .. function:: Math.mapLinear(x, a1, a2, b1, b2)
  18. //todo:description
  19. .. function:: Math.random16()
  20. Random float from <0, 1> with 16 bits of randomness
  21. (standard Math.random() creates repetitive patterns when applied over larger space)
  22. :returns: Random float from <0, 1> with 16 bits of randomness
  23. :rtype: float
  24. .. function:: Math.randInt(low, high)
  25. :returns: Random integer from *low* to *high* interval
  26. :rtype: integer
  27. .. function:: Math.randFloat(low, high)
  28. :returns: Random float from *low* to *high* interval
  29. :rtype: float
  30. .. function:: Math.randFloatSpread(range)
  31. :returns: Random float from -range/2 to range/2 interval
  32. :rtype: float