LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-24-2009, 12:01 PM   #1
asmahan
LQ Newbie
 
Registered: Jul 2009
Posts: 15

Rep: Reputation: 0
a good random number generator in C++


hey
i know rand() and srand() random number generator in c++ , but i need a more accurate and complicated one.
any help!
 
Old 08-24-2009, 12:09 PM   #2
H_TeXMeX_H
LQ Guru
 
Registered: Oct 2005
Location: $RANDOM
Distribution: slackware64
Posts: 12,928
Blog Entries: 2

Rep: Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301Reputation: 1301
Accurate ? I don't think that word has anything to do with random number generators.

Complicated ? Well, I'm sure you can find more complicated ones on the internet, but I don't think the complexity of a random number generator has anything to do with how good it is.

I recommend you just use some bytes out of '/dev/urandom' as a seed for the rand and srand functions. I've written a C program for this myself, but you need C++. If you want I'll post the C one I wrote.

Could you be a bit more specific about what you really need. Maybe knowing why you need it or what it will be used for will help.
 
Old 08-24-2009, 01:40 PM   #3
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by asmahan View Post
any help?
Try having a look at this: Donald Knuth's RANARRAY algorithm.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
I need a random number generator newbiesforever Linux - Software 5 05-22-2009 02:04 PM
random number generator vkmgeek Programming 3 09-02-2008 09:41 AM
Sea Monkey Random Number Generator jschiwal General 2 02-23-2007 10:27 PM
does GNU's g77 come with a random number generator? terrence Programming 1 08-30-2005 09:29 PM
Random number generator for linux Steve_Taylor Programming 12 09-30-2001 04:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:18 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration