Suggestion for testlib's random.

Revision en4, by DeadlyCritic, 2020-06-15 10:07:00

In the name of God;

Testlib has nice random functions, here I want to suggest some other ones. The first and the second random functions are available in testlib, but the rest are not.

  1. $$$\text{rnd.next(l, r)}$$$, it will return a random number in range $$$l$$$ to $$$r$$$ with equal weights :

  1. $$$\text{rnd.wnext(l, r, w)}$$$, it will return a random number in range $$$l$$$ to $$$r$$$ with monotonically increasing/decreasing weights depending on $$$w$$$ :

if $$$w = 0$$$ then it will be equal to $$$\text{rnd.next(l, r)}$$$.

if $$$w > 0$$$ :

if $$$w < 0$$$ :

![ ](https://codeforces.net/69ca9c/wnext graph neg.png)

  1. $$$\text{rnd.cnext(l, r, c)}$$$, it will return a random number in range $$$l$$$ to $$$r$$$ :

4, \text{

Tags random, testlib

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en13 English DeadlyCritic 2020-06-15 16:32:35 205
en12 English DeadlyCritic 2020-06-15 11:35:10 11
en11 English DeadlyCritic 2020-06-15 11:14:44 7 Tiny change: 'em.\n\n2. Print $c1+1$-th' -> 'em.\n\n2. Return $c1+1$-th'
en10 English DeadlyCritic 2020-06-15 11:10:15 166
en9 English DeadlyCritic 2020-06-15 11:04:43 476 (published)
en8 English DeadlyCritic 2020-06-15 10:47:50 83
en7 English DeadlyCritic 2020-06-15 10:46:37 188
en6 English DeadlyCritic 2020-06-15 10:38:02 331
en5 English DeadlyCritic 2020-06-15 10:07:41 82
en4 English DeadlyCritic 2020-06-15 10:07:00 183
en3 English DeadlyCritic 2020-06-15 10:04:43 96
en2 English DeadlyCritic 2020-06-15 09:57:51 23 Tiny change: 'es :\n\n![looool](/predown' -> 'es :\n\n![ ](/predown'
en1 English DeadlyCritic 2020-06-15 09:56:56 676 Initial revision (saved to drafts)