Torus calculation question

If you take a Torus and want to use it generate a lot of little things along its shape i.e. in a ring, how would you do that? C# is preferred if there’s code involved but seriously, how would you code something like that?

How do you create a torus? Define a circle, revolve it around a fixed point.

Or, taking that in reverse: define a circle around a fixed point, then define more circles around that first circle.

Here’s a very simple proof-of-concept:

public class Torus : MonoBehaviour {

    //demo function: once attached to a GameObject, the editor window will draw dots on a torus
	void OnDrawGizmos() {
		for (int i=0; i<400; i++) {
			Gizmos.DrawSphere(RandomPointInTorus(10f, 1f, true), 0.1f);
		}
	}
	
	Vector3 RandomPointInTorus(float radius1, float radius2, bool surfaceOnly) {
		return RandomPointInTorus(radius1, radius2, surfaceOnly, Vector3.right, Vector3.up);
	}
	
    //provide radius for first, second circle; unit vectors to provide torus axes
	Vector3 RandomPointInTorus(float radius1, float radius2, bool surfaceOnly, Vector3 x1, Vector3 y1) {
	
		//random point on first circle
		float theta1 = Random.Range(0f, 2f * Mathf.PI);
		Vector3 point1 = radius1 * (x1 * Mathf.Cos(theta1) + y1 * Mathf.Sin(theta1));
	
		//lazy way to get orthogonal vectors
		//spawn a new GameObject, make it look at point1, grab its transform properties
		GameObject temp = new GameObject("temp");
		temp.transform.LookAt(point1, y1);
		Vector3 x2 = temp.transform.forward;
		Vector3 y2 = temp.transform.right;
		DestroyImmediate(temp);
		
		//second radius: absolute, or maximum?
		//in other words, do we want points ON the torus or IN the torus?
		if (!surfaceOnly) {
			radius2 = Random.Range(0f, radius2);
		}
		
		//random point on second circle
		float theta2 = Random.Range(0f, 2f * Mathf.PI);
		Vector3 point2 = point1 + radius2 * (x2 * Mathf.Cos(theta2) + y2 * Mathf.Sin(theta2));
		
		return point2;
	}
}

The above could probably be tweaked or optimized quite a bit, but I got curious and wanted to take a quick stab at it.