Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

random number generator?

Altera_Forum
Honored Contributor II
1,227 Views

Hi I am new to nios ii and was wondering if there was a random number generator. I have been try to use rand(), but it seems to only return 0s. I was wondering if I was doing something wrong. Could someone explain what libraries I should include? These are the libraries I am using thus far: 

# include "alt_types.h" 

# include "altera_avalon_pio_regs.h" 

# include "alt_ucosii_simple_error_check.h" 

 

# include <stdlib.h> 

# include <stdio.h> 

# include <system.h> 

# include <sys/time.h> 

# include <sys/alt_timestamp.h>
0 Kudos
1 Reply
Altera_Forum
Honored Contributor II
371 Views

 

--- Quote Start ---  

originally posted by neeljoe@Aug 15 2006, 03:54 PM 

hi i am new to nios ii and was wondering if there was a random number generator. i have been try to use rand(), but it seems to only return 0s.  

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=17627) 

--- quote end ---  

 

--- Quote End ---  

 

 

Did you initialized it using srand()? 

 

Paolo
0 Kudos
Reply