Gamestudio Links
Zorro Links
Newest Posts
ZorroGPT
by TipmyPip. 03/01/26 16:40
WFO Training with parallel cores Zorro64
by Martin_HH. 02/26/26 16:03
Zorro version 3.0 prerelease!
by TipmyPip. 02/25/26 16:38
Camera always moves upwards?
by clonman. 02/21/26 09:29
Sam Foster Sound | Experienced Game Composer for Hire
by titanicpiano14. 02/19/26 13:22
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
3 registered members (Quad, TipmyPip, Grant), 5,429 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
the1, alx, ApprenticeInMuc, PatrickH90, USER0328
19200 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