Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

randomex.py 378 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
  1. import numpy as np
  2. def random_normal( size=(1,), trunc_val = 2.5 ):
  3. len = np.array(size).prod()
  4. result = np.empty ( (len,) , dtype=np.float32)
  5. for i in range (len):
  6. while True:
  7. x = np.random.normal()
  8. if x >= -trunc_val and x <= trunc_val:
  9. break
  10. result[i] = (x / trunc_val)
  11. return result.reshape ( size )
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...