Tutorial to generate random number

Started by Ergosphere on

Topic category: User side tutorials

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

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?

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?