LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-01-2015, 05:35 AM   #1
Feed
LQ Newbie
 
Registered: Jul 2015
Posts: 3

Rep: Reputation: Disabled
Mersenne Twister pseudorandom number generator under Ubuntu


Hello all!
I need to generate Mersenne Twister pseudorandom number generator and
I can't understand how to use /dev/random or /dev/urandom.I guess that is much better than srand(time(NULL))

Thanx!
 
Old 07-02-2015, 12:41 PM   #2
Varda
LQ Newbie
 
Registered: Jul 2015
Posts: 1

Rep: Reputation: Disabled
I think you're correct /dev/random much better than srand.

---------- Post added 07-02-15 at 12:42 PM ----------

Just look here, I guess that it's what you're looking for.
 
1 members found this post helpful.
Old 07-02-2015, 12:50 PM   #3
Feed
LQ Newbie
 
Registered: Jul 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
2Varda, Thank you very much!!!
PS
I found this.
You're absolutely right!
 
Old 07-03-2015, 05:07 PM   #4
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
What are you going to be using it for ? As it is pseudorandom non-cryptographic, you can just use the system time.
 
Old 07-06-2015, 06:55 AM   #5
Feed
LQ Newbie
 
Registered: Jul 2015
Posts: 3

Original Poster
Rep: Reputation: Disabled
2metaschima

I'm not sure that seed generated by this way can be use for generation any random distribution function...Besides, I guess that use native linux feature it's more right approach.
 
Old 07-06-2015, 12:45 PM   #6
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
The output data is definitely going to be randomly distributed, as long as the seed is not the same every time. Using the time or /dev/urandom means that the seed won't be the same every time you run it.
 
  


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
Number series generator sniff Programming 8 08-23-2005 03:26 AM
mersenne prime number zetsui Linux - Software 3 08-23-2003 01:23 PM
Random number generator for linux Steve_Taylor Programming 12 09-30-2001 04:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:54 PM.

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