pseudo_random 2.0.0 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e4970f4efb26dab591b3993a5f32aa7c7dbbdc5c95c902b0ec17cc4bed992d30
4
- data.tar.gz: 21d3fbe2944dee77e0bdcd119a5c4e36a35216d51da00e2f12a06e71f05db1c0
3
+ metadata.gz: 62b608038d538d7b3b2214254d4e4c710e12850447f61946e7160fcb8f7431db
4
+ data.tar.gz: f15a95f68ae4a7abec4b36f2b7b66128472e7a27290c0c83e853f09ae439f034
5
5
  SHA512:
6
- metadata.gz: 50e2ddda1158f48552b8817974c1e3f95e3cbe021307fbb9e84e8f29b1c0175adb2cf3a37da418f4fe0978b5d1a4498c34f13a3dd9ef00d4814c4682f9c37f4d
7
- data.tar.gz: c6c820faf822459093a3bb9be9d4617256fa0c03acb310ed97bdd0d97100f0d4558bc204d94710f4d7107cbff9351597dc78ee22708b0fb12ad2ad560cae2761
6
+ metadata.gz: cb223bd31b10081e99f70306d078a10ee29b705223e8b861353f43cb3a40a1897eb4c999b4b22290fe1a727df8e30daab3e2b041a8faedb630fc3d8f85b70449
7
+ data.tar.gz: b2a176e1dfea1b430771ba69cac292b441779f8e5c9321c468a8e7b462c42525324f18d7d05baad334c076d9ea140fa835bf8275a2ec362d369b446e2791c219
data/CHANGELOG.md CHANGED
@@ -16,6 +16,14 @@ Deprecations: A deprecated feature will remain for at least one MINOR release af
16
16
 
17
17
  ## [Unreleased]
18
18
 
19
+ ## [2.0.1] - 2025-12-20
20
+
21
+ ### Fixed
22
+
23
+ - Fixed README examples to match actual execution results
24
+ - Updated all code examples with correct output values
25
+ - Examples now accurately reflect the deterministic behavior of the library
26
+
19
27
  ## [2.0.0] - 2025-12-06
20
28
 
21
29
  ### Changed
@@ -63,7 +71,8 @@ Deprecations: A deprecated feature will remain for at least one MINOR release af
63
71
  - Initial release: Deterministic pseudo-random generator (numbers / hex / alphabetic / alphanumeric string generation)
64
72
  - Support for arbitrary object seeds
65
73
 
66
- [Unreleased]: https://github.com/aYosukeMakita/pseudo_random/compare/v2.0.0...HEAD
74
+ [Unreleased]: https://github.com/aYosukeMakita/pseudo_random/compare/v2.0.1...HEAD
75
+ [2.0.1]: https://github.com/aYosukeMakita/pseudo_random/compare/v2.0.0...v2.0.1
67
76
  [2.0.0]: https://github.com/aYosukeMakita/pseudo_random/compare/v1.0.1...v2.0.0
68
77
  [1.0.1]: https://github.com/aYosukeMakita/pseudo_random/compare/v1.0.0...v1.0.1
69
78
  [1.0.0]: https://github.com/aYosukeMakita/pseudo_random/releases/tag/v1.0.0
data/README.md CHANGED
@@ -132,19 +132,19 @@ generator = PseudoRandom.new(42)
132
132
 
133
133
  # Float in [0.0, 1.0)
134
134
  random_float = generator.rand
135
- puts random_float # => 0.6394267984578837
135
+ puts random_float # => 0.8731369804701281
136
136
 
137
137
  # Integer in [0, 9]
138
138
  random_int = generator.rand(10)
139
- puts random_int # => 6
139
+ puts random_int # => 9
140
140
 
141
141
  # Float in [0.0, 10.0)
142
142
  random_float_range = generator.rand(10.0)
143
- puts random_float_range # => 9.66814512009282
143
+ puts random_float_range # => 3.440017825456998
144
144
 
145
145
  # Integer in [1, 100]
146
146
  random_range = generator.rand(1..100)
147
- puts random_range # => 64
147
+ puts random_range # => 41
148
148
  ```
149
149
 
150
150
  ### Convenience one-off methods
@@ -152,19 +152,19 @@ puts random_range # => 64
152
152
  ```ruby
153
153
  # One-off random number
154
154
  result = PseudoRandom.rand(seed: 42)
155
- puts result # => 0.6394267984578837
155
+ puts result # => 0.8731369804701281
156
156
 
157
157
  # One-off hex string
158
158
  hex = PseudoRandom.hex(seed: 'my_seed', length: 16)
159
- puts hex # => "a1b2c3d4e5f67890"
159
+ puts hex # => "cee117d6757980b7"
160
160
 
161
161
  # One-off alphabetic string
162
162
  alpha = PseudoRandom.alphabetic(seed: 'my_seed', length: 12)
163
- puts alpha # => "AbCdEfGhIjKl"
163
+ puts alpha # => "aZikVznxlLXj"
164
164
 
165
165
  # One-off alphanumeric string
166
166
  alnum = PseudoRandom.alphanumeric(seed: 'my_seed', length: 10)
167
- puts alnum # => "A1b2C3d4E5"
167
+ puts alnum # => "Q3a2S8sXED"
168
168
 
169
169
  # These are equivalent to creating a generator and calling the method once:
170
170
  # PseudoRandom.hex(seed: 'my_seed', length: 16) == PseudoRandom.new('my_seed').hex(16)
@@ -177,23 +177,23 @@ You can pass any Ruby object as a seed to `PseudoRandom.new`. The object will be
177
177
  ```ruby
178
178
  # String seed
179
179
  generator1 = PseudoRandom.new("hello")
180
- puts generator1.rand # => 0.1915194503788923
180
+ puts generator1.rand # => 0.37097030662852004
181
181
 
182
182
  # Array seed
183
183
  generator2 = PseudoRandom.new([1, 2, 3])
184
- puts generator2.rand # => 0.04548605918364251
184
+ puts generator2.rand # => 0.41837699041143994
185
185
 
186
186
  # Hash seed
187
187
  generator3 = PseudoRandom.new({ name: "John", age: 30 })
188
- puts generator3.rand # => 0.7550896311312906
188
+ puts generator3.rand # => 0.5869273234945404
189
189
 
190
190
  # Time seed
191
191
  generator4 = PseudoRandom.new(Time.new(2023, 1, 1))
192
- puts generator4.rand # => 0.4320558086698993
192
+ puts generator4.rand # => 0.6345803634459501
193
193
 
194
194
  # Omitted seed (uses hash of nil)
195
195
  generator5 = PseudoRandom.new
196
- puts generator5.rand # => 0.8501480898450888
196
+ puts generator5.rand # => 0.9527695090684619
197
197
  ```
198
198
 
199
199
  ### Hex string generation
@@ -203,15 +203,15 @@ generator = PseudoRandom.new("secret")
203
203
 
204
204
  # 8 hex characters
205
205
  hex_string = generator.hex(8)
206
- puts hex_string # => "a1b2c3d4"
206
+ puts hex_string # => "0b628b64"
207
207
 
208
208
  # 10 hex characters
209
209
  hex_string_10 = generator.hex(10)
210
- puts hex_string_10 # => "a50ee918e5"
210
+ puts hex_string_10 # => "6f291838f3"
211
211
 
212
212
  # 16 hex characters
213
213
  long_hex = generator.hex(16)
214
- puts long_hex # => "a1b2c3d4e5f67890"
214
+ puts long_hex # => "afef24ef63f4e104"
215
215
 
216
216
  # Empty string (length 0)
217
217
  empty_hex = generator.hex(0)
@@ -231,11 +231,11 @@ gen2 = PseudoRandom.new("test")
231
231
  end
232
232
 
233
233
  # Example output:
234
- # gen1: 0.5985762380674765, gen2: 0.5985762380674765
235
- # gen1: 0.8325673044064309, gen2: 0.8325673044064309
236
- # gen1: 0.24136065771243595, gen2: 0.24136065771243595
237
- # gen1: 0.7392418174919607, gen2: 0.7392418174919607
238
- # gen1: 0.9853406830436152, gen2: 0.9853406830436152
234
+ # gen1: 0.7714906738735868, gen2: 0.7714906738735868
235
+ # gen1: 0.9245604822851962, gen2: 0.9245604822851962
236
+ # gen1: 0.4030548732252476, gen2: 0.4030548732252476
237
+ # gen1: 0.07008281657880167, gen2: 0.07008281657880167
238
+ # gen1: 0.8898582626604018, gen2: 0.8898582626604018
239
239
  ```
240
240
 
241
241
  ### Practical examples
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PseudoRandom
4
- VERSION = '2.0.0'
4
+ VERSION = '2.0.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pseudo_random
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - aYosukeMakita