Skip to content

Instantly share code, notes, and snippets.

@terrycojones
Created January 6, 2012 23:51
Show Gist options
  • Save terrycojones/1573060 to your computer and use it in GitHub Desktop.
Save terrycojones/1573060 to your computer and use it in GitHub Desktop.
>>> import random
>>> random.random()
0.029650172560125809
>>> a = []
>>> for _ in range(10):
... a.append(random.random())
...
>>> a
[0.91210492275504895, 0.22509397965651112, 0.16240150096214034, 0.13481671367764725, 0.845419365903325, 0.28331432867986228, 0.37570713121626798, 0.75618618732045528, 0.16750228011314672, 0.19512649502603097]
>>> s = set(a)
>>> s
set([0.13481671367764725, 0.75618618732045528, 0.22509397965651112, 0.91210492275504895, 0.845419365903325, 0.28331432867986228, 0.37570713121626798, 0.16750228011314672, 0.16240150096214034, 0.19512649502603097])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment