On 2013-05-24 14:43, Chris Angelico wrote:
On Fri, May 24, 2013 at 11:23 PM, Peter Brooks
wrote:
Actually, thinking about
it, there is probably a source of non-algorithmically-derived 'random'
numbers somewhere on the net that would do the job nicely.
True entropy is usually provided by a sou
> Date: Fri, 24 May 2013 17:28:07 -0700
> Subject: Re: Simple algorithm question - how to reorder a sequence
> economically
> From: peter.h.m.bro...@gmail.com
> To: python-list@python.org
[...]
> If the scenario could be modelled ma
On Fri, May 24, 2013 at 11:23 PM, Peter Brooks
wrote:
> Actually, thinking about
> it, there is probably a source of non-algorithmically-derived 'random'
> numbers somewhere on the net that would do the job nicely.
True entropy is usually provided by a source such as /dev/random (on
Unix systems)
On 05/25/2013 09:49 PM, Roy Smith wrote:
In article <15a1bb3a-514c-454e-a966-243c84123...@googlegroups.com>,
John Ladasky wrote:
Because someone's got to say it... "The generation of random numbers is too
important to be left to chance." ‹ Robert R. Coveyou
Absolutely. I know just enough
In article <15a1bb3a-514c-454e-a966-243c84123...@googlegroups.com>,
John Ladasky wrote:
> Because someone's got to say it... "The generation of random numbers is too
> important to be left to chance." Robert R. Coveyou
Absolutely. I know just enough about random number generation to
unders
On Friday, May 24, 2013 10:33:47 AM UTC-7, Yours Truly wrote:
> If you don't reshuffle p, it guarantees the maximum interval between reusing
> the same permutation.
Of course, that comes at a certain price. Given two permutations p[x] and
p[x+1], they will ALWAYS be adjacent, in every repetition
On May 24, 11:33 pm, Carlos Nepomuceno
wrote:
>
>
>
>
>
>
>
>
>
>
> > Date: Fri, 24 May 2013 12:01:35 -0700
> > Subject: Re: Simple algorithm question - how to reorder a sequence
> > economically
>
> Date: Fri, 24 May 2013 12:01:35 -0700
> Subject: Re: Simple algorithm question - how to reorder a sequence
> economically
> From: peter.h.m.bro...@gmail.com
> To: python-list@python.org
>
> On May 24, 5:00 pm, Carlos Nepomuceno
>
On May 24, 5:00 pm, Carlos Nepomuceno
wrote:
>
>
> I don't know what "spurious evidence of correlation" is. Can you give a
> mathematical definition?
>
If I run the simulation with the same sequence, then, because event E1
always comes before event E2, somebody might believe that there is a
causa
On Friday, May 24, 2013 3:52:18 AM UTC-7, Steven D'Aprano wrote:
> On Fri, 24 May 2013 01:14:45 -0700, Peter Brooks wrote:
>
> > That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
> > 2,1,4,3) that is different each time.
>
> You can't *guarantee* that it will be different each
> Date: Fri, 24 May 2013 01:14:45 -0700
> Subject: Simple algorithm question - how to reorder a sequence economically
> From: peter.h.m.bro...@gmail.com
> To: python-list@python.org
>
> What is the easiest way to reorder a sequence pseudo-
On 24/05/13 10:11, Chris Angelico wrote:
On Fri, May 24, 2013 at 6:47 PM, Fábio Santos wrote:
On 24 May 2013 09:41, "Chris Angelico" wrote:
On Fri, May 24, 2013 at 6:14 PM, Peter Brooks
wrote:
What is the easiest way to reorder a sequence pseudo-randomly?
That is, for a sequence 1,2,3,4
On Fri, 24 May 2013 06:23:14 -0700, Peter Brooks wrote:
> Thanks for the warnings about random numbers too - I hope my lists will
> be short enough for the permutations of the function to be irrelevant. I
> don't need every single sequence to be unique, only that the same
> sequence only occurs o
Thank you all for those most helpful suggestions! random.shuffle does
precisely the job that I need quickly. Thank you for introducing me to
itertools, though, I should have remembered APL did this in a symbol
or two and I'm sure that itertools will come in handy in future.
Thanks for the warnings
On 5/24/2013 6:52 AM, Steven D'Aprano wrote:
On Fri, 24 May 2013 01:14:45 -0700, Peter Brooks wrote:
What is the easiest way to reorder a sequence pseudo-randomly?
import random
random.shuffle(sequence)
The sequence is modified in place, so it must be mutable. Lists are okay,
tuples are not.
On Fri, 24 May 2013 01:14:45 -0700, Peter Brooks wrote:
> What is the easiest way to reorder a sequence pseudo-randomly?
import random
random.shuffle(sequence)
The sequence is modified in place, so it must be mutable. Lists are okay,
tuples are not.
> That is, for a sequence 1,2,3,4 to produ
On 5/24/2013 4:14 AM, Peter Brooks wrote:
What is the easiest way to reorder a sequence pseudo-randomly?
That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
2,1,4,3) that is different each time.
I'm writing a simulation and would like to visit all the nodes in a
different order
On Fri, May 24, 2013 at 6:47 PM, Fábio Santos wrote:
>
> On 24 May 2013 09:41, "Chris Angelico" wrote:
>>
>> On Fri, May 24, 2013 at 6:14 PM, Peter Brooks
>> wrote:
>> > What is the easiest way to reorder a sequence pseudo-randomly?
>> >
>> > That is, for a sequence 1,2,3,4 to produce an arbitra
On 24 May 2013 09:41, "Chris Angelico" wrote:
>
> On Fri, May 24, 2013 at 6:14 PM, Peter Brooks
> wrote:
> > What is the easiest way to reorder a sequence pseudo-randomly?
> >
> > That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
> > 2,1,4,3) that is different each time.
> >
..
On Fri, May 24, 2013 at 6:14 PM, Peter Brooks
wrote:
> What is the easiest way to reorder a sequence pseudo-randomly?
>
> That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
> 2,1,4,3) that is different each time.
>
> I'm writing a simulation and would like to visit all the nodes
What is the easiest way to reorder a sequence pseudo-randomly?
That is, for a sequence 1,2,3,4 to produce an arbitrary ordering (eg
2,1,4,3) that is different each time.
I'm writing a simulation and would like to visit all the nodes in a
different order at each iteration of the simulation to remo
Brigette Hodson wrote:
> Hello! I am in a beginning algorithms class this semester and I am
> working on a presentation. I want to discuss in some detail the
> algorithm python uses to determine the hash function for python
> dictionaries. Does anyone know what this algorithm is? Or where I can go
You might be interested in the "Beautiful Code" book:
http://oreilly.com/catalog/9780596510046/
It has a chapter on Python's dict implementation that is pretty good.
On Tue, Dec 16, 2008 at 10:51 AM, Brigette Hodson
wrote:
> Hello! I am in a beginning algorithms class this semester and I am work
Brigette Hodson schrieb:
> Hello! I am in a beginning algorithms class this semester and I am working
> on a presentation. I want to discuss in some detail the algorithm python
> uses to determine the hash function for python dictionaries. Does anyone
> know what this algorithm is? Or where I can g
Hello! I am in a beginning algorithms class this semester and I am working
on a presentation. I want to discuss in some detail the algorithm python
uses to determine the hash function for python dictionaries. Does anyone
know what this algorithm is? Or where I can go to find information on it?
Tha
In message <[EMAIL PROTECTED]>, Andrew McLean wrote:
> I have the ability to query a database in a legacy system and extract
> records which match a particular pattern. Specifically, I can perform
> queries for records that contain a given search term as a sub-string of
> a particular column.
Wha
Gabriel Genellina wrote:
> This is known as a "set cover" algorithm. You have a set of subsets,
> and want to determine the smallest set of those subsets, whose union
> is the universal set - (uh, what a mess!)
I thought of that too, but he seems to be adding a second desired
property: the inters
At Thursday 14/9/2006 20:31, Andrew McLean wrote:
Now I want to issue a series of queries, such that when I combine all
the data returned I have accessed all the records in the database.
However, I want to minimise the total number of queries and also want to
keep the number of records returned
Andrew McLean wrote:
> Now I want to issue a series of queries, such that when I combine all
> the data returned I have accessed all the records in the database.
> However, I want to minimise the total number of queries and also want to
> keep the number of records returned by more than one query
John Machin wrote:
> A quick silly question: what is the problem that you are trying to
> solve?
A fair question :-)
The problem may seem a bit strange, but here it is:
I have the ability to query a database in a legacy system and extract
records which match a particular pattern. Specifically,
Andrew McLean wrote:
> Carl Banks wrote:
> > Andrew McLean wrote:
> >> I have a list of strings, A. I want to find a set of strings B such that
> >> for any "a in A" there exists "b in B" such that b is a sub-string of a.
> >
> > B=A?
> >
> >> But I also want to minimise T = sum_j t_j where
> >> t
Carl Banks wrote:
> Andrew McLean wrote:
>> I have a list of strings, A. I want to find a set of strings B such that
>> for any "a in A" there exists "b in B" such that b is a sub-string of a.
>
> B=A?
>
>> But I also want to minimise T = sum_j t_j where
>> t_j = count of the number of elements i
Andrew McLean wrote:
> I have a list of strings, A. I want to find a set of strings B such that
> for any "a in A" there exists "b in B" such that b is a sub-string of a.
B=A?
> But I also want to minimise T = sum_j t_j where
> t_j = count of the number of elements in A which have b[j] as a sub-s
On 2006-09-10, Andrew McLean <[EMAIL PROTECTED]> wrote:
> This really an algorithm question more that a Python question,
> but it would be implemented in Python
In that case, try comp.programming. But still...
> I have a list of strings, A. I want to find a set of strings B
This really an algorithm question more that a Python question, but it
would be implemented in Python
I have a list of strings, A. I want to find a set of strings B such that
for any "a in A" there exists "b in B" such that b is a sub-string of a.
But I also want to mi
Brian you are right, but in my case (host, port, protocol) is unique.
[EMAIL PROTECTED] schreef:
> Guyon Morée wrote:
> > i have a big list of tuples like this:
> >
> > [ (host, port, protocol, startime, endtime), .. ] etc
> >
> > now i have another big(ger) list of tuples like this:
> >
> > [(s
Guyon Morée wrote:
> i have a big list of tuples like this:
>
> [ (host, port, protocol, startime, endtime), .. ] etc
>
> now i have another big(ger) list of tuples like this:
>
> [(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc
>
> now i need to find all the items in the seco
>> I'd say it is as fast as it can get - using hashing for lookups is O
>> (n) in
>
>
> I know you meant O(1) for hash lookups, but just in case anyone is
> confused, I figured I'd correct this.
Ooops. Thanks.
Diez
--
http://mail.python.org/mailman/listinfo/python-list
On Aug 1, 2006, at 11:13 AM, Diez B. Roggisch wrote:
> Guyon Morée wrote:
>
>> Memory is no problem. It just needs to be as fast as possible, if
>> that's what this is, fine.
>>
>> If not, I'd like to find out what is :)
>
> I'd say it is as fast as it can get - using hashing for lookups is O
>
Guyon Morée wrote:
> Memory is no problem. It just needs to be as fast as possible, if
> that's what this is, fine.
>
> If not, I'd like to find out what is :)
I'd say it is as fast as it can get - using hashing for lookups is O(n) in
most cases, where bisection or other order-based lookups have
Memory is no problem. It just needs to be as fast as possible, if
that's what this is, fine.
If not, I'd like to find out what is :)
thanx,
Guyon Moree
http://gumuz.looze.net
Paul Rubin schreef:
> "Guyon Morée" <[EMAIL PROTECTED]> writes:
> > if (((src_host,src_port, protocol) in dict or (de
"Guyon Morée" <[EMAIL PROTECTED]> writes:
> if (((src_host,src_port, protocol) in dict or (dest_host, dest_port,
> protocol) in dict) and starttime < time < endtime):
> print "we have a winner"
If you have enough memory to do it that way, what's the problem?
--
http://mail.python.org/mailman/li
hi all,
i have a big list of tuples like this:
[ (host, port, protocol, startime, endtime), .. ] etc
now i have another big(ger) list of tuples like this:
[(src_host, src_port, dest_src, dest_port, protocol, time), ... ] etc
now i need to find all the items in the second list where either
src_
43 matches
Mail list logo