Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Set interval with random numbers

New Here ,
Nov 20, 2018 Nov 20, 2018

I'm trying to generate random numbers every 5 seconds and to output in a dynamic text box using Animate Canvas.In the canvas, I have a dynamic text box named numberOutput.

So far, I have—

var max = 225;

var min = 70;

this.numberOutput.text=[Math.floor(Math.random() * (max - min + 1) ) + min];

This works but with no interval.

How do I put the interval so the dynamic text generates a random number every 5 seconds?

Thanks.

737
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Nov 20, 2018 Nov 20, 2018

The scripting language for Canvas documents is JavaScript. So any basic programming questions will be JavaScript questions.

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout

Translate
LEGEND ,
Nov 20, 2018 Nov 20, 2018
LATEST

The scripting language for Canvas documents is JavaScript. So any basic programming questions will be JavaScript questions.

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setInterval

https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines