forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commite634132
committed
Add functions to generate random numbers in a specified range.
This adds 3 new variants of the random() function: random(min integer, max integer) returns integer random(min bigint, max bigint) returns bigint random(min numeric, max numeric) returns numericEach returns a random number x in the range min <= x <= max.For the numeric function, the number of digits after the decimal pointis equal to the number of digits that "min" or "max" has after thedecimal point, whichever has more.The main entry points for these functions are in a new C source file.The existing random(), random_normal(), and setseed() functions aremoved there too, so that they can all share the same PRNG state, whichis kept private to that file.Dean Rasheed, reviewed by Jian He, David Zhang, Aleksander Alekseev,and Tomas Vondra.Discussion:https://postgr.es/m/CAEZATCV89Vxuq93xQdmc0t-0Y2zeeNQTdsjbmV7dyFBPykbV4Q@mail.gmail.com1 parent818861e commite634132
File tree
13 files changed
+1022
-101
lines changed- doc/src/sgml
- src
- backend/utils/adt
- common
- include
- catalog
- common
- utils
- test/regress
- expected
- sql
13 files changed
+1022
-101
lines changedLines changed: 38 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1862 | 1862 |
| |
1863 | 1863 |
| |
1864 | 1864 |
| |
| 1865 | + | |
| 1866 | + | |
| 1867 | + | |
| 1868 | + | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
| 1883 | + | |
| 1884 | + | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
1865 | 1898 |
| |
1866 | 1899 |
| |
1867 | 1900 |
| |
| |||
1906 | 1939 |
| |
1907 | 1940 |
| |
1908 | 1941 |
| |
1909 |
| - | |
1910 |
| - | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
1911 | 1945 |
| |
1912 | 1946 |
| |
1913 | 1947 |
| |
1914 | 1948 |
| |
1915 |
| - | |
| 1949 | + | |
1916 | 1950 |
| |
1917 | 1951 |
| |
1918 | 1952 |
| |
1919 |
| - | |
| 1953 | + | |
1920 | 1954 |
| |
1921 |
| - | |
1922 | 1955 |
| |
1923 | 1956 |
| |
1924 | 1957 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
82 | 82 |
| |
83 | 83 |
| |
84 | 84 |
| |
| 85 | + | |
85 | 86 |
| |
86 | 87 |
| |
87 | 88 |
| |
|
Lines changed: 0 additions & 95 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
21 | 21 |
| |
22 | 22 |
| |
23 | 23 |
| |
24 |
| - | |
25 | 24 |
| |
26 | 25 |
| |
27 |
| - | |
28 | 26 |
| |
29 | 27 |
| |
30 | 28 |
| |
| |||
64 | 62 |
| |
65 | 63 |
| |
66 | 64 |
| |
67 |
| - | |
68 |
| - | |
69 |
| - | |
70 |
| - | |
71 | 65 |
| |
72 | 66 |
| |
73 | 67 |
| |
| |||
2785 | 2779 |
| |
2786 | 2780 |
| |
2787 | 2781 |
| |
2788 |
| - | |
2789 |
| - | |
2790 |
| - | |
2791 |
| - | |
2792 |
| - | |
2793 |
| - | |
2794 |
| - | |
2795 |
| - | |
2796 |
| - | |
2797 |
| - | |
2798 |
| - | |
2799 |
| - | |
2800 |
| - | |
2801 |
| - | |
2802 |
| - | |
2803 |
| - | |
2804 |
| - | |
2805 |
| - | |
2806 |
| - | |
2807 |
| - | |
2808 |
| - | |
2809 |
| - | |
2810 |
| - | |
2811 |
| - | |
2812 |
| - | |
2813 |
| - | |
2814 |
| - | |
2815 |
| - | |
2816 |
| - | |
2817 |
| - | |
2818 |
| - | |
2819 |
| - | |
2820 |
| - | |
2821 |
| - | |
2822 |
| - | |
2823 |
| - | |
2824 |
| - | |
2825 |
| - | |
2826 |
| - | |
2827 |
| - | |
2828 |
| - | |
2829 |
| - | |
2830 |
| - | |
2831 |
| - | |
2832 |
| - | |
2833 |
| - | |
2834 |
| - | |
2835 |
| - | |
2836 |
| - | |
2837 |
| - | |
2838 |
| - | |
2839 |
| - | |
2840 |
| - | |
2841 |
| - | |
2842 |
| - | |
2843 |
| - | |
2844 |
| - | |
2845 |
| - | |
2846 |
| - | |
2847 |
| - | |
2848 |
| - | |
2849 |
| - | |
2850 |
| - | |
2851 |
| - | |
2852 |
| - | |
2853 |
| - | |
2854 |
| - | |
2855 |
| - | |
2856 |
| - | |
2857 |
| - | |
2858 |
| - | |
2859 |
| - | |
2860 |
| - | |
2861 |
| - | |
2862 |
| - | |
2863 |
| - | |
2864 |
| - | |
2865 |
| - | |
2866 |
| - | |
2867 |
| - | |
2868 |
| - | |
2869 |
| - | |
2870 |
| - | |
2871 |
| - | |
2872 |
| - | |
2873 |
| - | |
2874 |
| - | |
2875 |
| - | |
2876 |
| - | |
2877 | 2782 |
| |
2878 | 2783 |
| |
2879 | 2784 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
69 | 69 |
| |
70 | 70 |
| |
71 | 71 |
| |
| 72 | + | |
72 | 73 |
| |
73 | 74 |
| |
74 | 75 |
| |
|
0 commit comments
Comments
(0)