samedi 14 janvier 2017

numpy.random.choice in Javascript?

Numpy.random.choice has a nice simple API letting you sample an array of ints based on some probability distribution:

>>> np.random.choice(5, 3, p=[0.1, 0, 0.3, 0.6, 0])
array([3, 3, 0])

Is there an equivalent in javascript (node js)?

Note: I found this package http://ift.tt/1VW9CcC but I don't like creating a hashmap/table every time I need to get a sample.




Aucun commentaire:

Enregistrer un commentaire