Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-07-2002, 11:16 PM   #1
sammy
Registered User
 
Join Date: Feb 2002
Posts: 2
Default A keno Game (Random Numbers)

I'm making a keno game and I need 20 random numbers, that do not repeat.
I'm new with arrays, and flash 5 scripting (Deleted Falsh 4)
If someone could please help, I'll stop banging my head against the wall!

Sammy

myArray=(0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16, 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33 ,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,5 0,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66, 67,68,69,70,71,72,73,74,75,76,77,78,79);
v = random(myarray)+1;
tellTarget (this.v) {
play ();
}
if (v<=40) {
t = t+1;
} else {
b = b+1;
}
sammy is offline   Reply With Quote
Old 02-08-2002, 09:33 AM   #2
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

Here you go:
Code:
function ranNumArray (values, limit) {
	var count = -1;
	var numbers = new Array();
	while (numbers.length<=values) {
		var match = false;
		count++;
		var ran = random(limit);
		for (var x = 0; x<=numbers.length; x++) {
			if (ran == numbers[x]) {
				match = true;
				break;
			}
		}
		if (!match) {
			numbers[count] = ran;
		} else {
			count--;
		}
	}
	return numbers;
}
trace (ranNumArray(20, 70));
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 02-08-2002, 05:58 PM   #3
sammy
Registered User
 
Join Date: Feb 2002
Posts: 2
Default Thank you!

I am your humble servant from this day forward!
sammy is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
how to generate Random Questions for a game? Blackshark ActionScript 2.0 13 04-20-2007 04:42 AM
game with random sound clips scott_allen13 ActionScript 2.0 6 03-01-2005 07:11 PM
need decoder that will generate random 7 numbers with some fixed sum devil ActionScript 2.0 15 05-26-2004 02:00 PM
random numbers with no repeat daspetey ActionScript 2.0 2 02-19-2004 02:11 PM
Making random numbers indiochano Simple Stuff (Newbies) 6 07-10-2003 12:10 AM


All times are GMT. The time now is 12:44 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.