473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Preferred Random Library

Is there a preferred random library?

scipy.random
random

Besides scipy's library returning ndarrays, is there any other
advantage/disadvantage?
Apr 26 '07 #1
4 1673
Bill Jackson <ja*****@hotmail.comwrites:
Is there a preferred random library?
Preferred for what? Maybe you want os.urandom().
Apr 26 '07 #2
Paul Rubin wrote the following on 04/25/2007 10:17 PM:
Bill Jackson <ja*****@hotmail.comwrites:
>Is there a preferred random library?

Preferred for what? Maybe you want os.urandom().
How about for general usage...I am just asking for a very broad
description of the advantages/disadvantages of each.

For instance, what is the scipy.random equivalent of random.jumpahead()?

Apr 26 '07 #3
Bill Jackson wrote:
Is there a preferred random library?

scipy.random
random

Besides scipy's library returning ndarrays, is there any other
advantage/disadvantage?
numpy.random (since that's where scipy.random comes from, I recommend always
referring to it as numpy.random) can be a bit faster since it is implemented as
entirely an extension module; parts of random are implemented in Python and
incur Python function call overhead. It's certainly faster if you need a lot of
numbers at once. numpy.random has several more non-uniform distributions
implemented.

numpy.random does not implement jumpahead(). random, naturally, does not require
a third-party package.

By and large, I'd say the distinguishing factor is whether or not you want to
use numpy in your program. If so, then use numpy.random. If not, then use random.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Apr 26 '07 #4
"Robert Kern" <ro*********@gmail.comwrote in message
news:ma***************************************@pyt hon.org...
numpy.random does not implement jumpahead().
Which may be removed from the random API:
http://www.python.org/dev/peps/pep-3...andard-library

Cheers,
Alan Isaac
Apr 26 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Brandon Michael Moore | last post by:
I'm trying to test a web application using a tool written in python. I would like to be able to generate random values to put in fields. I would like to be able to generate random dates (in a...
5
by: Yudan YI \(OSU\) | last post by:
I want to generate random data from a normal distribution, while I checked the functions, and I found rand(), which returns a pseudorandom integer between zero and RAND_MAX. I am not sure how to...
9
by: greeningster | last post by:
I have written an application in Visual C++ for a customer but it seems to crash randomly. Could anyone give me any help on how I could track this down ? Also, there appears there might be...
7
by: BOOGIEMAN | last post by:
//Why this doesn't work : using System; using System.Threading; class RandomObjectDemo { public static void Main( ) { Thread.Sleep( 1 );
2
by: godyuyu | last post by:
i need change the system preferred audio device in my vc++ project ,but i can't find the resolution.I just want to know the method.
38
by: One Handed Man \( OHM - Terry Burns \) | last post by:
I have a basic question thats been niggling me, but I never found time to look at it before. If I have an enumeration such as this Fiend Enum TravelDirection North South East
3
by: Jeff | last post by:
I was testing out some code to create a string of random characters. The code inside of the Button1 Click event was along the lines of: Dim i as Integer Dim rGen as New Random() Dim uniqueName as...
15
by: felixnielsen | last post by:
This is something i have done before and i know its pretty simple, however i cant remember how it works exactly, and i need it i kinda hurry, so if someone would be so nice to drop a random number...
3
by: pedestrian via DotNetMonster.com | last post by:
Let's say I declares an array of string (of size 1000), how to fill every elements of it with random characters? Dim myStrArray(999) As String ... Thanks... -- Pedestrian, Penang.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.