You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -333,7 +333,7 @@ You may, of course, want to choose the characters used, which is covered next in
333
333
Being able to easily generate random strings is great, but what if you want to specify your own characters. For example, suppose you want to visualize flipping a coin to produce entropy of 10 bits.
334
334
335
335
```js
336
-
import {Random, charSet2} from'./entropy-string'
336
+
import {Random, charSet2} from'entropy-string'
337
337
338
338
let random =newRandom(charSet2)
339
339
let flips =random.string(10)
@@ -353,7 +353,7 @@ The resulting string of __0__'s and __1__'s doesn't look quite right. Perhaps yo
353
353
As another example, we saw in [Character Sets](#CharacterSets) the default characters for CharSet 16 are **0123456789abcdef**. Suppose you like uppercase hexadecimal letters instead.
354
354
355
355
```js
356
-
import {Random} from'./entropy-string'
356
+
import {Random} from'entropy-string'
357
357
358
358
let random =newRandom('0123456789ABCDEF')
359
359
let string =random.string(48)
@@ -371,7 +371,7 @@ The `Random` constructor allows for 3 separate cases:
371
371
The 3rd option above will throw an `Error` if the characters string isn't appropriate.
372
372
373
373
```js
374
-
import {Random} from'./entropy-string'
374
+
import {Random} from'entropy-string'
375
375
376
376
try {
377
377
let random =newRandom('123456')
@@ -419,7 +419,7 @@ There are two significant issues with this code. `Math.random` returns a random
419
419
Compare that to the `entropy-string` scheme. For the example above, slicing off 5 bits at a time requires a total of 80 bits (10 bytes). Creating the same strings as above, `entropy-string` uses 80 bits of randomness per string with no wasted bits. In general, the `entropy-string` scheme can waste up to 7 bits per string, but that's the worst case scenario and that's *per string*, not *per character*!
420
420
421
421
```js
422
-
import {Random} from'./entropy-string'
422
+
import {Random} from'entropy-string'
423
423
424
424
let random =newRandom()
425
425
let string =random.string(80)
@@ -493,7 +493,7 @@ Note how the number of bytes needed is dependent on the number of characters in
493
493
494
494
##### In a *million* strings, a *1 in a billion* chance of a repeat (using 32 possible characters):
0 commit comments