super_random 3.1.230114 → 3.2.230116
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/super_random.rb +18 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80443021c230106600a502974f5ae31b39f6e6f22b5c1e50eef7a00f03b8c9b9
|
4
|
+
data.tar.gz: c4133b454e2e339d5f59d9d64da877fa3ae8831fe701b9846bd86d0cd79906f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eee1ab617d8e57d836f519f96c504ba3e1bb8331ab3e7e300b3cf8360711e4fe688016af2fe37c0ef3f5fb60b74f7883b36c17ccfd496a4a227d416ddf0f8489
|
7
|
+
data.tar.gz: 3cee029f0a3ad6ee2a730934112b91a7997ac55ce0cc760ce17fde375ef5fb87fb0b88cc94dbc90dd73d1dbbb10c63f49467d61fb1f04a878840ad0b42b5afda
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# SuperRandom
|
2
2
|
|
3
|
-
* [VERSION 3.
|
3
|
+
* [VERSION 3.2.230116](https://github.com/carlosjhr64/super_random/releases)
|
4
4
|
* [github](https://github.com/carlosjhr64/super_random)
|
5
5
|
* [rubygems](https://rubygems.org/gems/super_random)
|
6
6
|
|
@@ -17,7 +17,7 @@ You can't get more random than random, but you can try really, really, really ha
|
|
17
17
|
## SYNOPSIS:
|
18
18
|
```ruby
|
19
19
|
require 'super_random'
|
20
|
-
SuperRandom::VERSION #=> "3.
|
20
|
+
SuperRandom::VERSION #=> "3.2.230116"
|
21
21
|
SuperRandom::DEFAULT_SOURCES #~> www.random.org
|
22
22
|
super_random = SuperRandom.new
|
23
23
|
super_random.sources #~> www.random.org
|
data/lib/super_random.rb
CHANGED
@@ -6,7 +6,7 @@ require 'digest'
|
|
6
6
|
#`ruby`
|
7
7
|
|
8
8
|
class SuperRandom
|
9
|
-
VERSION = '3.
|
9
|
+
VERSION = '3.2.230116'
|
10
10
|
DEFAULT_SOURCES = [
|
11
11
|
'https://www.random.org/strings/?num=10&len=20&digits=on&upperalpha=on&loweralpha=on&unique=on&format=plain&rnd=new',
|
12
12
|
]
|
@@ -38,16 +38,28 @@ class SuperRandom
|
|
38
38
|
hexadecimal.to_i(16)
|
39
39
|
end
|
40
40
|
|
41
|
+
def xy
|
42
|
+
hex = hexadecimal
|
43
|
+
x = hex[0...64].to_i(16)
|
44
|
+
y = hex[64..128].to_i(16)
|
45
|
+
return x,y
|
46
|
+
end
|
47
|
+
|
48
|
+
def integer2
|
49
|
+
# An alternate way to generate an integer
|
50
|
+
x,y = xy
|
51
|
+
# I think this is Binomial(Gaussian in the limit) around zero?
|
52
|
+
x - y
|
53
|
+
end
|
54
|
+
|
41
55
|
def float
|
42
56
|
Rational(integer, DIV).to_f
|
43
57
|
end
|
44
58
|
|
45
59
|
def float2
|
46
|
-
# An alternate way to generate a float
|
47
|
-
|
48
|
-
|
49
|
-
y = hex[64..128].to_i(16)
|
50
|
-
# ...what distribution is this?
|
60
|
+
# An alternate way to generate a float...
|
61
|
+
x,y = xy
|
62
|
+
# ...but what distribution is this?
|
51
63
|
Rational(x,y).to_f
|
52
64
|
rescue ZeroDivisionError
|
53
65
|
# Fat chance!
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: super_random
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.2.230116
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- CarlosJHR64
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |
|
14
14
|
You can't get more random than random, but you can try really, really, really hard.
|