Tutorial to generate random number

Started by Ergosphere on

Topic category: User side tutorials

Last seen on 13:10, 26. Sep 2021
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Tutorial to generate random number

You can use the code below the generate a random number. The top function is for when your minimum is 1. The bottom is for any other scenario.

For each function interchange 15 for your maximum number and change 5 for your minmum in the bottom one.

In code form the formula looks like this: 

(Math.random() * (maximum - minimum + 1)) + minimum

Rand

Last seen on 14:15, 15. May 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry but, Where should i…
Thu, 03/17/2022 - 23:50

Sorry but, Where should i put that in the structure of the code-blocks? It doesn't matter or it does?

Last seen on 14:15, 15. May 2022
Joined Mar 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Sorry but, Where should i…
Thu, 03/17/2022 - 23:56

Sorry but, Where should i put that in the structure of the code-blocks? It doesn't matter or it does?