search for: xrandom

Displaying 17 results from an estimated 17 matches for "xrandom".

Did you mean: random
2011 Sep 29
3
random effects
Hello I have a data set with fixed and random effects, therefore I am using the lme function: lm(y ~ xfixed, random=~1|xrandom, data) After this I want to get the F-values for both the fixed and random predictors. I can easily get the F-value and df for the xfixed predictors (anova()), but how to get the F-value for the xrandom predictors? Thanks in advance. /R
2018 Dec 28
1
[PATCH nbdkit] common: Improve pseudo-random number generation.
...ptography or security is + * required - use gcrypt if you need those. + */ + +struct random_state { + uint64_t s[4]; +}; + +static inline uint64_t +rotl (const uint64_t x, int k) +{ + return (x << k) | (x >> (64 - k)); +} + +/* Returns 64 random bits. Updates the state. */ +uint64_t +xrandom (struct random_state *state) +{ + const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; + const uint64_t t = state->s[1] << 17; + + state->s[2] ^= state->s[0]; + state->s[3] ^= state->s[1]; + state->s[1] ^= state->s[2]; + state->s[0] ^= state->s[3...
2018 Dec 28
0
[PATCH v2 nbdkit] common: Improve pseudo-random number generation.
...;s[1] = snext (&seed); + state->s[2] = snext (&seed); + state->s[3] = snext (&seed); +} + +static inline uint64_t +rotl (const uint64_t x, int k) +{ + return (x << k) | (x >> (64 - k)); +} + +/* Returns 64 random bits. Updates the state. */ +static inline uint64_t +xrandom (struct random_state *state) +{ + const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; + const uint64_t t = state->s[1] << 17; + + state->s[2] ^= state->s[0]; + state->s[3] ^= state->s[1]; + state->s[1] ^= state->s[2]; + state->s[0] ^= state->s[3...
2018 Dec 28
2
[PATCH v2 nbdkit] common: Improve pseudo-random number generation.
v2: - Fix seeding. - Add a test that nbdkit-random-plugin is producing something which looks at least somewhat random. Rich.
2019 Apr 24
0
[nbdkit PATCH 4/4] filters: Check for mutex failures
.../error.c +++ b/filters/error/error.c @@ -283,9 +283,10 @@ random_error (const struct error_settings *error_settings, * representable in a 64 bit integer, and because we don't need all * this precision anyway, let's work in 32 bits. */ - pthread_mutex_lock (&lock); - rand = xrandom (&random_state) & UINT32_MAX; - pthread_mutex_unlock (&lock); + { + ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock); + rand = xrandom (&random_state) & UINT32_MAX; + } if (rand >= error_settings->rate * UINT32_MAX) return false; diff --git a/filters/log/log.c...
2018 Dec 31
1
Re: [PATCH v2 nbdkit] common: Improve pseudo-random number generation.
...namely 0x61c8864680b583eb), the fact that xsrandom() calls snext() four times means that random_state is guaranteed to have at least three non-zero values, which was a documented prerequisite of the seeding. > +/* Returns 64 random bits. Updates the state. */ > +static inline uint64_t > +xrandom (struct random_state *state) > +{ > + const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; > + const uint64_t t = state->s[1] << 17; > + > + state->s[2] ^= state->s[0]; > + state->s[3] ^= state->s[1]; > + state->s[1] ^= state->s[2];...
2019 Apr 24
7
[nbdkit PATCH 0/4] More mutex sanity checking
I do have a question about whether patch 2 is right, or whether I've exposed a bigger problem in the truncate (and possibly other) filter, but the rest seem fairly straightforward. Eric Blake (4): server: Check for pthread lock failures truncate: Factor out reading real_size under mutex plugins: Check for mutex failures filters: Check for mutex failures filters/cache/cache.c
2019 Mar 19
0
[PATCH nbdkit 1/9] server: Implement extents/can_extents calls for plugins and filters.
...unsigned i; + uint64_t offset, length; + uint32_t type; + size_t j; + struct random_state random_state; + struct nbdkit_extents_map *map; + + xsrandom (time (NULL), &random_state); + + map = nbdkit_extents_new (); + assert (map != NULL); + + for (i = 0; i < 1000; ++i) { + type = xrandom (&random_state); + type &= 3; + offset = xrandom (&random_state); + offset &= DISK_SIZE - 1; + /* XXX Change the distribution so we mainly choose small lengths + * but with a small possibility of choosing large lengths. + */ + length = xrandom (&random_sta...
2019 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting history of this in libvirt -- try looking at commit eefb881 plus the commits referencing eefb881 -- but it does seem to work for me using recent GCC and Clang. I only did a few functions because annotating them gets old quickly... Rich.
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
..._nonnull__ (2))) xsrandom (uint64_t seed, struct random_state *state) { state->s[0] = snext (&seed); @@ -83,7 +83,7 @@ rotl (const uint64_t x, int k) } /* Returns 64 random bits. Updates the state. */ -static inline uint64_t +static inline uint64_t __attribute__((__nonnull__ (1))) xrandom (struct random_state *state) { const uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; diff --git a/common/regions/regions.h b/common/regions/regions.h index ca9b3d5..4fcaf09 100644 --- a/common/regions/regions.h +++ b/common/regions/regions.h @@ -76,25 +76,30 @@ struct regions {...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
2019 Mar 19
15
[PATCH nbdkit 0/9] [mainly for discussion and early review] Implement extents.
I want to post this but mainly for discussion and early review. It's not safe for these patches to all go upstream yet (because not all filters have been checked/adjusted), but if any patches were to go upstream then probably 1 & 2 only are safe. File, VDDK, memory and data plugins all work, although I have only done minimal testing on them. The current tests, such as they are, all
2019 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
...+ */ + if (create_filesystem (disk) == -1) + return -1; + + /* Create a random GUID used as "Unique partition GUID". However + * this doesn't follow GUID conventions so in theory could make an + * invalid value. + */ + for (i = 0; i < 16; ++i) + disk->guid[i] = xrandom (&random_state) & 0xff; + + /* Create the virtual disk regions. */ + if (create_regions (disk) == -1) + return -1; + + /* Initialize partition table structures. This depends on + * disk->regions so must be done last. + */ + if (create_partition_table (disk) == -1) + return...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...+ */ + if (create_filesystem (disk) == -1) + return -1; + + /* Create a random GUID used as "Unique partition GUID". However + * this doesn't follow GUID conventions so in theory could make an + * invalid value. + */ + for (i = 0; i < 16; ++i) + disk->guid[i] = xrandom (&random_state) & 0xff; + + /* Create the virtual disk regions. */ + if (create_regions (disk) == -1) + return -1; + + /* Initialize partition table structures. This depends on + * disk->regions so must be done last. + */ + if (create_partition_table (disk) == -1) + return...
2019 Feb 22
5
[PATCH nbdkit v3 0/4] Add linuxdisk plugin.
For v3 I reimplemented this using mke2fs -d. This obviously makes the implementation a whole lot simpler, but cannot support multiple directory merging. Patches 1-3 are the same as before. I've also reproduced the notes from v2 below. v2: - Fix inconsistent tab/space. - All 3 plugins now contain a block of text pointing to the other 2 plugins. - TMDIR -> TMPDIR - Unlink the
2019 Feb 19
6
[PATCH nbdkit v2 0/5] Add linuxdisk plugin.
Another interesting thing you can do with this plugin: https://rwmj.wordpress.com/2019/02/19/nbdkit-linuxdisk-plugin/ v2: - Fix inconsistent tab/space. - All 3 plugins now contain a block of text pointing to the other 2 plugins. - TMDIR -> TMPDIR - Unlink the temporary file and other cleanups along error paths. - fclose -> pclose, and check the return value for errors. -
2019 Feb 19
7
[PATCH nbdkit 0/4] New plugin: Add linuxdisk plugin.
Turns out Japanese trains are good for coding! In supermin we have a bunch of code to create the libguestfs appliance. It creates it directly using libext2fs (part of e2fsprogs). We can use the same technique to create ext2 virtual disks in nbdkit, which is what this new plugin does. Why a new plugin instead of modifying the floppy plugin? See the 4/4 commit message for an explanation. The