Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41149
| X-Received | by 10.224.72.199 with SMTP id n7mr11952731qaj.5.1363119676915; Tue, 12 Mar 2013 13:21:16 -0700 (PDT) |
|---|---|
| X-Received | by 10.49.58.167 with SMTP id s7mr1363422qeq.5.1363119676860; Tue, 12 Mar 2013 13:21:16 -0700 (PDT) |
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news.glorb.com!dd2no2065156qab.0!news-out.google.com!o5ni743qas.0!nntp.google.com!dd2no2065154qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail |
| Newsgroups | comp.lang.python |
| Date | Tue, 12 Mar 2013 13:21:16 -0700 (PDT) |
| In-Reply-To | <0aa38f5a-0e5e-43cd-b6ba-69af6f37e94e@googlegroups.com> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=66.162.99.34; posting-account=aw7wEQoAAACnaP8vftI9MyiC9NfXNJyr |
| NNTP-Posting-Host | 66.162.99.34 |
| References | <mailman.3237.1363108626.2939.python-list@python.org> <0aa38f5a-0e5e-43cd-b6ba-69af6f37e94e@googlegroups.com> |
| User-Agent | G2/1.0 |
| MIME-Version | 1.0 |
| Message-ID | <bcb46e43-51c7-40ba-bd4a-3787ce9f8ceb@googlegroups.com> (permalink) |
| Subject | Re: How can i create a random array of floats from 0 to 5 in python |
| From | llanitedave <llanitedave@veawb.coop> |
| Cc | python-list@python.org, Norah Jones <nh.jones01@gmail.com> |
| Injection-Date | Tue, 12 Mar 2013 20:21:16 +0000 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | quoted-printable |
| Xref | csiph.com comp.lang.python:41149 |
Show key headers only | View raw
On Tuesday, March 12, 2013 10:47:25 AM UTC-7, Maarten wrote: > On Tuesday, March 12, 2013 6:11:10 PM UTC+1, Norah Jones wrote: > > > I want to create a random float array of size 100, with the values in the array ranging from 0 to 5. I have tried random.sample(range(5),100) but that does not work. How can i get what i want to achieve? > > > > Use numpy > > > > import numpy as np > > np.random.uniform(0, 5, 100) > > > > # note that the values are from the interval [0, 5) > > > > Maarten While numpy would work, I fail to see how encouraging the op to download and install a separate library and learn a whole new set of tools would be beneficial by default, without knowing the purpose of the need. This is like recommending an RPG to fix a sticky door hinge.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How can i create a random array of floats from 0 to 5 in python Norah Jones <nh.jones01@gmail.com> - 2013-03-12 17:11 +0000
Re: How can i create a random array of floats from 0 to 5 in python Maarten <maarten.sneep@knmi.nl> - 2013-03-12 10:47 -0700
Re: How can i create a random array of floats from 0 to 5 in python llanitedave <llanitedave@veawb.coop> - 2013-03-12 13:21 -0700
Re: How can i create a random array of floats from 0 to 5 in python Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-03-12 21:59 +0000
Re: How can i create a random array of floats from 0 to 5 in python llanitedave <llanitedave@veawb.coop> - 2013-03-12 22:35 -0700
Re: How can i create a random array of floats from 0 to 5 in python llanitedave <llanitedave@veawb.coop> - 2013-03-12 22:35 -0700
Re: How can i create a random array of floats from 0 to 5 in python llanitedave <llanitedave@veawb.coop> - 2013-03-12 13:21 -0700
Re: How can i create a random array of floats from 0 to 5 in python Maarten <maarten.sneep@knmi.nl> - 2013-03-12 10:47 -0700
csiph-web