randol

by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Auxiliary function
Introduced first in SolidGeometry 4.9, Creation date: 2020-07-31, Last change: 2025-09-14

return an random number with at least a minimum value unit the next perdecimal

Description

helpful for random overlap intervalls

See Also: , randminv

Example Illustration

 missing image of randol(r,c,rmin)

Syntax

r=randol([r,c,rmin])

Input Parameter

r: rows or minimum number
c: col
rmin: minimum number; default is 0.01

Output Parameter

r: randum number, or matrix

Examples


randol(4,4,.2) % 4x4 matrix, numbers between [0.2 and 0.3[




Copyright 2020-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth

Algorithm (Workflow)

This algorithm generates random numbers with a specified minimum value, useful for creating random overlap intervals. It is part of the SolidGeometry library.

Input Parameters

Output

Algorithm Steps

  1. Retrieve the input parameters using the function getfuncparams for r, c, and rmin.
  2. If only one argument is provided, set rmin to r and r to 1.
  3. Calculate i as 10^floor(log10(rmin)) to determine the order of magnitude of rmin.
  4. If rmin is a scalar, convert it to a range by setting rmin to [rmin+0.1*i, rmin+0.99*i].
  5. Generate a matrix of random numbers with dimensions r by c using rand(r,c).
  6. Scale and shift the random numbers to fit within the range specified by rmin.

This function is particularly useful for generating random numbers that need to be within a specific range, ensuring a minimum value is respected.

Algorithm explaination created using ChatGPT on 2025-08-18 23:34. (Please note: No guarantee for the correctness of this explanation)

Last html export of this page out of FM database by TL: 2025-09-21