/* * Losowanie liczb. * Copyright (C) 2004, 2005 Piotr 'GhosT' Wydrych (e-mail: user:ghost host:ciapek.uci.agh.edu.pl) * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. */ #include <stdio.h> #include <stdlib.h> #include <time.h> typedef unsigned int TYP; #define OZNACZENIE_TYPU "d" #define MAX 65535 // oznaczenie i zakres odpowiednio do printf(3) i TYPu #define ile 100 int main(void) { unsigned int i; srand((unsigned)(time(NULL))); for (i=0; i<ile; i++) fprintf(stdout, "%" OZNACZENIE_TYPU "\n", (TYP)((float) MAX*rand()/RAND_MAX)); return 0; }