Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (Ayumi, NewbieZorro, TipmyPip), 13,888 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 3 1 2 3
Re: While statements [Re: Icarni] #320576
04/22/10 20:19
04/22/10 20:19
Joined: May 2002
Posts: 7,441
ventilator Offline
Senior Expert
ventilator  Offline
Senior Expert

Joined: May 2002
Posts: 7,441
instead of the printf() you can write:

x_1 = numbers[0];
x_2 = numbers[1];
...

Re: While statements [Re: ventilator] #320590
04/22/10 22:15
04/22/10 22:15
Joined: Apr 2010
Posts: 20
I
Icarni Offline OP
Newbie
Icarni  Offline OP
Newbie
I

Joined: Apr 2010
Posts: 20
You rock, dude! I got it working, and I think I even understand how it operates. Thanks!

Re: While statements [Re: Icarni] #320602
04/22/10 22:57
04/22/10 22:57
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Code:
void main()
{
	randomize();
	
	int n;
	int numbers[10];
	int array[192];
	for(n=0; n<192; n++) array[n] = n + 1;  // fill array with 1..192
	
	for(n=0; n<10; n++)
	{
	    int index = random((191-n)+1);
	    numbers[n] = array[index];
	    array[index] = array[191-n]; // remove the number from the array by replacing it with the last one in the array (the last one won't be accessed anymore)
	}
	
	X_1 = numbers[0];
	X_2 = numbers[1];
	...
	X_10 = numbers[9];
	
	printf("%d %d %d %d %d %d %d %d %d %d", numbers[0], numbers[1], numbers[2], numbers[3], numbers[4], numbers[5], numbers[6], numbers[7], numbers[8], numbers[9]);
	
}




Last edited by Widi; 04/22/10 22:57.
Page 3 of 3 1 2 3

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1