Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,885 questions

51,811 answers

573 users

How to generate random numbers from the power function in NumPy with Python

1 Answer

0 votes
import numpy as np

floatnum = 2.0

randomnumbers = np.random.power(floatnum, size=30)

# Produces 30 values drawn from the Power distribution with exponent 2.0

print(randomnumbers)

   
'''
run:
 
[0.1740035  0.75182145 0.49597839 0.36973963 0.12025598 0.27882853
 0.86402424 0.67771898 0.90133237 0.3560534  0.49050153 0.98158343
 0.48664136 0.21238976 0.61693987 0.79968942 0.57462773 0.76397897
 0.6955343  0.31352032 0.77161529 0.96560834 0.61116719 0.80575677
 0.82586528 0.63886459 0.72805687 0.41758979 0.73627217 0.77142723]
   
'''

 



answered 10 hours ago by avibootz
...