OpenCores
URL https://opencores.org/ocsvn/tcp_socket/tcp_socket/trunk

Subversion Repositories tcp_socket

[/] [tcp_socket/] [trunk/] [chips2/] [examples/] [rand.c] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 jondawson
/*globals*/
2
unsigned long int seed;
3
 
4
void srand(unsigned long int s){
5
    seed = s;
6
}
7
 
8
unsigned long rand(){
9
    const unsigned long a = 1103515245ul;
10
    const unsigned long c = 12345ul;
11
    seed = (a*seed+c);
12
    return seed;
13
}
14
 
15
void main(){
16
    unsigned i;
17
    for (i=0; i<4096; i++){
18
        file_write(rand(), "x");
19
        file_write(rand(), "y");
20
        file_write(rand(), "z");
21
    }
22
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.