newRandomGenerator.lua 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. return {
  2. tag = 'random',
  3. summary = 'Create a new RandomGenerator.',
  4. description = [[
  5. Creates a new `RandomGenerator`, which can be used to generate random numbers. If you just want
  6. some random numbers, you can use `lovr.math.random`. Individual RandomGenerator objects are
  7. useful if you need more control over the random sequence used or need a random generator
  8. isolated from other instances.
  9. ]],
  10. arguments = {
  11. seed = {
  12. type = 'number',
  13. description = 'The initial seed for the RandomGenerator.'
  14. },
  15. low = {
  16. type = 'number',
  17. description = 'The lower 32 bits of the seed.'
  18. },
  19. high = {
  20. type = 'number',
  21. description = 'The upper 32 bits of the seed.'
  22. }
  23. },
  24. returns = {
  25. randomGenerator = {
  26. type = 'RandomGenerator',
  27. description = 'The new RandomGenerator.'
  28. }
  29. },
  30. variants = {
  31. {
  32. description = 'Create a RandomGenerator with a default seed.',
  33. arguments = {},
  34. returns = { 'randomGenerator' }
  35. },
  36. {
  37. arguments = { 'seed' },
  38. returns = { 'randomGenerator' }
  39. },
  40. {
  41. description = [[
  42. This variant allows creation of random generators with precise 64-bit seed values, since
  43. Lua's number format loses precision with really big numbers.
  44. ]],
  45. arguments = { 'low', 'high' },
  46. returns = { 'randomGenerator' }
  47. }
  48. }
  49. }