Simple random number generator?

  • 2 April 2020
  • 8 replies
  • 5965 views

Userlevel 7

Would there be a quick and dirty way to create a random number widget/addin which could be used for things like simulating a coin flip or rolling a dice? 

Right now, I’m using an external URL to Google Dice but would prefer something which didn’t require learners to jump out of their class boards.

Thanks!

Kiron


8 replies

Userlevel 7

The closest I’ve been able to come with my (VERY STALE) development background was to open the Developer Tools panel in Chrome, and paste this into the console “alert('You rolled a ' + (Math.floor( Math.random() * 6 ) +1));

This works, but it is a kludgy solution. My preferred option would be a simple button in the bottom bar which would pop up the alert when you click on it.

I’m guessing this would take a Miro developer all of half an hour to develop & test it so hopefully this inspires one of them :joy:

 

 

Userlevel 7

I found the following code which uses a third-party site to do this. I dropped it into an iframe widget and it works but is still a bit kludgy:

<iframe src="https://www.random.org/widgets/integers/iframe.php?title=Roll+The+Dice&amp;buttontxt=Roll&amp;width=160&amp;height=200&amp;border=on&amp;bgcolor=%23FFFFFF&amp;txtcolor=%23777777&amp;altbgcolor=%23CCCCFF&amp;alttxtcolor=%23000000&amp;defaultmin=1&amp;defaultmax=6&amp;fixed=on" frameborder="0" width="160" height="200" scrolling="no" longdesc="https://www.random.org/integers/">
The numbers generated by this widget come from RANDOM.ORG's true random number generator.
</iframe>

Userlevel 7

Hi Kiron,

it works - thanks for sharing.

Whats nice is that the rest of my board gets greyed out and this tool gets into the focus.

Michael

Userlevel 7

Thanks Michael! 

It is still a bit of an ugly solution as you can’t customize the look of the iFrame box and I’ve been unable to get the external widget to use different text labels or colors. 

Perhaps @Boris Borodyansky will find a half-hour of spare time on his hands to whip up a quick bottom bar app for us :joy:

Kiron

Userlevel 3

I’ll see what I can do… :stuck_out_tongue_winking_eye:

Userlevel 7

Awesome @Boris Borodyansky - it would be great to have a native widget vs. the kludge of an iFrame based 3rd party site.

Kiron

I also need the dice roller desperately! Trying to find something, but nothing works but the one Kiron suggested. The problem of this “dice” is that only the person who rolls it can see the result. Working with children I can´t always trust the numbers they say they get :sweat_smile: ! So, @Boris Borodyansky I will also be terribly grateful for your kind support! 

Alexandra

Userlevel 7

@Aleksandra Dmitrieva -

A solution (third-party) was provided here: https://community.miro.com/wish-list-32/randomizer-dice-coin-percent-etc-283

Kiron

Reply