Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #41136 > unrolled thread

Re: How can i create a random array of floats from 0 to 5 in python

Started byBoris FELD <lothiraldan@gmail.com>
First post2013-03-12 18:25 +0100
Last post2013-03-12 18:25 +0100
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How can i create a random array of floats from 0 to 5 in python Boris FELD <lothiraldan@gmail.com> - 2013-03-12 18:25 +0100

#41136 — Re: How can i create a random array of floats from 0 to 5 in python

FromBoris FELD <lothiraldan@gmail.com>
Date2013-03-12 18:25 +0100
SubjectRe: How can i create a random array of floats from 0 to 5 in python
Message-ID<mailman.3238.1363109169.2939.python-list@python.org>
You can use [random.random() * 5 for x in range(100)] but works only
on range [0, 5). If you want to include 5, you will need more code.

Cheers,
FELD Boris

2013/3/12 Norah Jones <nh.jones01@gmail.com>:
> 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?
> --
> http://mail.python.org/mailman/listinfo/python-list
>

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web