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

Subversion Repositories tcp_socket

[/] [tcp_socket/] [trunk/] [chips2/] [examples/] [rand.c] - Rev 4

Compare with Previous | Blame | View Log

/*globals*/
unsigned long int seed;
 
void srand(unsigned long int s){
    seed = s;
}
 
unsigned long rand(){
    const unsigned long a = 1103515245ul;
    const unsigned long c = 12345ul;
    seed = (a*seed+c);
    return seed;
}
 
void main(){
    unsigned i;
    for (i=0; i<4096; i++){
        file_write(rand(), "x");
        file_write(rand(), "y");
        file_write(rand(), "z");
    }
}
 

Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

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