Random number generator

Random Number Generator

I made a little flash movie a while ago that generates a random number and displays it in a fashion that puts slot machines to shame when it comes to pure excitement and drama. I’d almost forgotten about it when I checked my stats last week and noticed that it’s actually being used. I revisited the code last night and ironed out a few mistakes. It for instance no longer attempts to find numbers between 1 and say “monkey”. Nor does it accept negative numbers. It can draw numbers between 1 and any number you want up to a quadrillion. And of course it was in dire need of some easter eggs…

So, next time you need to decide who should take out the trash, who’s diaper-turn it is or who gets the last slice of pizza, go to my random number generator and let a complete unbiased Flash movie settle it.

Since very many of you were emailing me about possibly releasing the source files, I’ve decided to place them online. Click here to download them. It’s all Actionscript 2 though, and frame-based (no classes). It was all the rage back then ;). Support not included.
Roy | February 14, 2007 | English,Internet | Comments (36)
Tags: , , ,

36 Comments

  1. Nice! thanks a lot, I am going to use it as a speedometer hit counter in flash.

    Thanks again.

    Comment by matt — June 30, 2007 @ 5:15 pm

  2. this is great, and loved the number animation.
    is there any way I could get the FLA for this one?

    Comment by andré henriques — May 28, 2008 @ 5:40 pm

  3. Hi André. I don’t generally give out fla files. What would you be using it for?

    Comment by Roy — May 28, 2008 @ 6:06 pm

  4. An excellent thing. Do you have this as a swf? I would like to use it in an animation to generate winners for school attendance

    many thanks

    stew

    Comment by stew — October 2, 2008 @ 11:26 am

  5. Hi, good job!
    I use for work, but it’s possible to customize the background with new color or image?

    Comment by Andrea — January 24, 2009 @ 1:29 pm

  6. hai roy… good job with the program…
    my i have the fla files to add some new pic and color
    coz my boss wanna use it for voting who’s first who’s last thing.
    pleaseee…

    Comment by haniff — July 29, 2009 @ 7:05 am

  7. Thank you so much for this great program. Can I please have the fla files for this please please please.. We have to a mini-game and we have to choose the winner. I would like to add my company’s picture to background and some other stuffs cuz we’ll put this video on the website “how did we choose the winner number” stuff :D Please send me the fla files mate.. Thank you again so much,

    Comment by Baris — October 1, 2009 @ 10:15 am

  8. Is there any way to ‘store’ a result from your random number generator? We have a weekly lottery in our soccer team, and it would be really nice if I could direct everybody to the page with the week’s winner in a webpage.

    Thanks!

    Comment by Alvaro — July 27, 2010 @ 9:53 pm

    • Alvaro, other than recording to video (screen capture?) I can’t think of a way to have the app produce the same numbers twice.

      Comment by Roy — August 4, 2010 @ 11:32 am

  9. Hi Roy,

    I bump into your site while searching for flash random number. could you provide the fla? i would like to add this to a lucky draw mechanism which our company has for a dinner event.

    possible?

    Comment by Jinn — October 4, 2010 @ 4:57 am

  10. Hi Jinn. You have mail :).

    Comment by Roy — October 5, 2010 @ 11:55 am

  11. Hi Roy,

    Appreciate if you could email me the fla file as well. I really need it for my company’s lucky draw event. I’ve searched everywhere for something like this for weeks. Yours was simply the best!

    Comment by din — October 15, 2010 @ 6:43 pm

  12. Hi Roy,

    Am assigned on the program committee for our company’s upcoming Christmas party… Would really like to add some Christmas themes as background for the generator. Perhaps I can bother you to mail me the fla file? :)

    Many Thanks.

    Comment by Ryan — October 28, 2010 @ 3:55 pm

  13. Hi Roy,
    Could you email me the fla files as well?
    We will have a Christmas party at our company with some random Christmas presents distribution. I was thinking using your generator. If I could change the theme to a Christmas one and include our company’s logo it would be great.
    Thanks

    Comment by Eduardo — November 26, 2010 @ 4:08 pm

  14. Hi Roy,
    As above, I am running a draw for xmas, but for our entire Air Force Base. A Christmas themed background would be epic, any help and the fla files would be greatly apreciated.

    Mase

    Comment by Mase — December 1, 2010 @ 9:24 pm

  15. Hi Roy,
    awesome you’re rock dude, this is what i’ve been searching for whole week.
    thank you so much

    Comment by Gejrotz — July 24, 2011 @ 5:47 pm

  16. Hi Roy,
    Very Nice Work
    I Liked It
    Plzzzzzzzzzzzzzzz I need A Help From You
    I Need The fla and xml all the files of Random Number Generator
    Plzzzzzzzzzzzz I need Him
    Thank You
    God Bless You

    Comment by John — July 28, 2011 @ 11:39 am

    • Ho John. I was away on vacation when your comment rolled in. If you still need the fla, please email me.

      Comment by Roy — August 14, 2011 @ 11:28 am

  17. I am trying to figure out how to make a spinner, spin a random number of times to land on a number on a wheel – so the arrow rotates at a point. The reason I don’t want to use random number generator is that it is for group work and normally there would be four people, so four sectors it could possibly land on, but if there is an odd group that has 3 or 5, I would be able to assign them a random number with the same spin. SoI would essentially have 3 loops inside one another with different ranges of numbers, so inner circle 3 numbers then middle circle 4 numbers then outer circle 5 numbers. This would rely on a spinning arrow rotating about the centre of the circles. Hopefully it could start off spinning fast and gradually slow down. This rotation could be doen with a for next loop using a mod 360 function for a full circle and a loop inside a loop just for timing and the inside for next loop increasing the more times the loop goes round until it stops, giving the effect of slowing down. I’ve not done must scripting in Flash ro use of buttons as a prompt, am okay with drawing the background and tweening, but not sure how to get it rotate a random number of times and after a button is pressed.

    Comment by Wayne Prout — October 1, 2011 @ 12:53 am

    • Sounds like scripting really is the way to go. You could do something simple like initially setting the rotation property of the wheel to a random number, and then using the Tween class to rotate it back to zero. Shouldn’t be too hard.

      Comment by Roy — October 3, 2011 @ 2:47 pm

  18. Hi Roy – I love this program and want to use it at the weekend as a prize ‘spin to win’ game for my friends but is it possible to have this program spin the numbers on the press of a key instead of using a mouse so that I can get everyone just to press the space key and it spins instead of using the mouse?

    Many thanks

    Jamie

    Comment by Jamie — October 17, 2011 @ 9:46 pm

    • Possible, yes. But the current version does not do that. Are you any good at Actionscript?

      Comment by Roy — October 19, 2011 @ 1:36 pm

  19. No sorry not really any good with Actionscript at all – do you think its best to leave it?

    Thanks

    Comment by Jamie — October 19, 2011 @ 7:50 pm

  20. Hello Roy,
    Love this program. We have a lottery at our church for donated car. I appreciate if you can send me the FLA file as well I will try to use it. Mainly I will like to change the minimum and maximum number.
    This is great. I am not good at all in actionscript. I know Java and C++.
    Regards; /

    Comment by Hailu — October 21, 2011 @ 11:55 pm

  21. Hello Roy,

    Thanks for the source. Can you please help me where I can make the minim number in the code?. My minim is 201 and maximum is variable.

    Comment by Hailu Mengistu — October 27, 2011 @ 4:16 am

    • If I remember correctly, the download version should have an XML file that lets you specify the range(s).

      Comment by Roy — October 31, 2011 @ 11:49 am

      • Dear Mr Roy,

        The downloaded version given is only for number between 10 to 20. I already extracted the file and open the XML file, but I can’t change the range. tell me how..

        Comment by Rahim — December 14, 2011 @ 9:23 am

        • You should be able to change the rang through the XML. That’s what it’s for. Did you unpack all the files to the same location? And are you using a text editor to edit the XML, not a word processor?

          Comment by Roy — December 20, 2011 @ 10:32 am

  22. hye there, im creating the design for oil and gas company. so that, the company ask me the generator for their lucky draw when their annual dinner. can i hae the fla file.

    thanx in advanced! :)

    Comment by han — November 5, 2011 @ 12:30 pm

  23. Hi there Roy!

    Great piece of work! Can it be configured the way that I can specify the result number – I would like to attach this to our lottery system – all I need is to generate the number visually, technically it’s already saved to db while starting the generator.

    Comment by Erki — November 16, 2011 @ 11:16 am

    • That would require a bit of tinkering with the source code, but it’s absolutely doable. Please email me if you want the fla files.

      Comment by Roy — November 21, 2011 @ 11:45 am

  24. Good day Roy,

    I downloaded your random number generator but the software only able to do random number between 10 to 20. Pls help

    Comment by Rahim — December 14, 2011 @ 9:13 am

  25. Great…. Coooool…. at last.. i found it here… this is what i’ve been searching for whole week.
    could you provide the fla? i would like to add this to a lucky draw
    mechanism which our company has for upcoming labour day dinner. If I could change the
    theme to a Labour day one and include our company’s logo it would be great.
    Appreciate if you could email me the fla file… Plzzzzzzzzzzzz you’re my saviour..

    Thank you so much..

    Comment by Galique — April 10, 2012 @ 1:22 am

  26. Hey Roy,

    Like a whole bunch of people up there, I need to slap on a company logo and change the colours around a little bit. The .fla file would be much appreciated!

    Thanks!

    Comment by Benjamin — April 25, 2012 @ 7:27 am

    • There’s a link in the post to a zip with all the source files.

      Comment by Roy — April 26, 2012 @ 12:53 pm

  27. Thanx a lot!!!! very good i hope the next version will heve the option for changing the background

    Comment by Gorjan — May 16, 2012 @ 1:44 pm