[BangPypers] What is the output of this python program?

Anand B Pillai abpillai at gmail.com
Fri Apr 5 15:52:29 CEST 2013


This tells one not to really on PRNGs to generate a truly random
state.

It is not very difficult to write some code to find the seed for
printing a given word if you got some time to waste :)

Here is one way.

http://pastebin.ca/2350376

Sample:

>>> findseed.find_seed_for_word('hello',100000)
0th count reached
100000th count reached
200000th count reached
300000th count reached
400000th count reached
500000th count reached
600000th count reached
700000th count reached
800000th count reached
900000th count reached
1000000th count reached
1100000th count reached
1200000th count reached
1300000th count reached
1400000th count reached
1500000th count reached
1600000th count reached
1700000th count reached
1800000th count reached
1900000th count reached
Seed is 1944062
Time taken: 30.5493340492

30s to find the seed, not as bad as I thought.




On Fri, Apr 5, 2013 at 4:51 PM, Abdul Muneer <abdulmuneer at gmail.com> wrote:

> Printing 'hello world' like a sir! :)
>
> p.s.:caution when using builtins as variable names. (e.g.: len)
>
> Regards,
> Abdul Muneer
>
> --
> Follow me on Twitter: @abdulmuneer <http://twitter.com/#%21/abdulmuneer>
>
>
> On Fri, Apr 5, 2013 at 4:06 PM, Mandar Vaze / मंदार वझे <
> mandarvaze at gmail.com> wrote:
>
> > > Seeding a pseudo-random number generator makes it
> > > always generate a sequence specific to the seed.
> >
> >
> > http://xkcd.com/221/
> >
> > -Mandar
> > _______________________________________________
> > BangPypers mailing list
> > BangPypers at python.org
> > http://mail.python.org/mailman/listinfo/bangpypers
> >
> _______________________________________________
> BangPypers mailing list
> BangPypers at python.org
> http://mail.python.org/mailman/listinfo/bangpypers
>



-- 
Regards,

--Anand


More information about the BangPypers mailing list